Hi, weiß zufällig jemand warum meine do-while schleife nicht funktioniert ? und rechnen funktioniert auch nicht ... ich hab keine ahnung warum :-( kann mir evtl jemand erklären warum das so ist und ggf einen lösungsvorschlag ?
1 | #include <iostream> |
2 | #include <math.h> |
3 | using namespace std; |
4 | |
5 | |
6 | int main () |
7 | {
|
8 | double Operant1; |
9 | double Operant2; |
10 | int MOp; |
11 | char XX; |
12 | |
13 | do
|
14 | {
|
15 | cout <<"Bitte geben sie Operant 1 ein: " << endl; |
16 | cin >> Operant1; |
17 | cout <<"Bitte geben sie Operant 2 ein: " << endl; |
18 | cin >> Operant2; |
19 | cout <<" Folgende Operationen sind Möglich (+ - * / % !)" << endl; |
20 | cin >> MOp; |
21 | |
22 | if (MOp == '+') |
23 | {
|
24 | cout <<" Das Ergebnis ist: " << Operant1 + Operant2 << endl; |
25 | }
|
26 | else if ( MOp == '-') |
27 | {
|
28 | cout <<" Das Ergebnis ist: " << Operant1 - Operant2 << endl; |
29 | }
|
30 | else if ( MOp == '*') |
31 | {
|
32 | cout <<" Das Ergebnis ist: " << Operant1 * Operant2 << endl; |
33 | }
|
34 | else if ( MOp == '/') |
35 | {
|
36 | cout <<" Das Ergebnis ist: " << Operant1 / Operant2 << endl; |
37 | }
|
38 | else if ( MOp == '%') |
39 | {
|
40 | cout <<" Das Ergebnis ist: " << Operant1 * Operant2 << endl; |
41 | }
|
42 | cout << "Erneute Rechnung? j/n" << endl; |
43 | cin >> XX; |
44 | }while (XX == 'J' || XX == 'j'); |
45 | |
46 | |
47 | system ("PAUSE"); |
48 | |
49 | |
50 | return 0; |
51 | }
|