fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. auto Start = true;
  7. while (Start) {
  8. // SetConsoleTitle(TEXT("Rechner"));
  9. std::cout << "Wollen sie den Rechner Starten? (0=false/1=true)\n";
  10. std::cin >> Start;
  11.  
  12. if (!Start) {
  13. return 0;
  14. }
  15.  
  16. // int RechenArt;
  17. // std::cout << "Addition = 1, Subtraktion = 2, Multiplikation = 3, Division = 4\n";
  18. // std::cin >> RechenArt;
  19. // system("cls");
  20.  
  21. int Zahl1;
  22. int Zahl2;
  23. char op;
  24.  
  25.  
  26. cout << "Bitte Formel eingeben:" << endl;
  27. std::cin >> Zahl1;
  28. std::cin >> op;
  29. std::cin >> Zahl2;
  30.  
  31. const char opVal = op;
  32.  
  33. switch (opVal) {
  34. case '+':
  35. // SetConsoleTitle(TEXT("Addition"));
  36. system("cls");
  37. std::cout << "Ergebnis: " << "" << Zahl1 << " + " << "" << Zahl2 << " = " << Zahl1 + Zahl2 << std::endl;
  38. break;
  39. case '-':
  40. // SetConsoleTitle(TEXT("Subtraktion"));
  41. system("cls");
  42. std::cout << "Ergebnis: " << "" << Zahl1 << " - " << "" << Zahl2 << " = " << Zahl1 - Zahl2 << std::endl;
  43. break;
  44. case '*':
  45. // SetConsoleTitle(TEXT("Multiplikation"));
  46. system("cls");
  47. std::cout << "Ergebnis: " << "" << Zahl1 << " * " << "" << Zahl2 << " = " << Zahl1 * Zahl2 << std::endl;
  48. break;
  49. case '/':
  50. // SetConsoleTitle(TEXT("Divison"));
  51. system("cls");
  52. std::cout << "Ergebnis: " << "" << Zahl1 << " / " << "" << Zahl2 << " = " << Zahl1 / Zahl2 << std::endl;
  53. break;
  54.  
  55. default:
  56. return 0;
  57. }
  58. system("PAUSE");
  59. }
  60. }
Success #stdin #stdout #stderr 0s 16064KB
stdin
1
10+2
1
10/2
1
10*2
1
10-2
0
stdout
Wollen sie den Rechner Starten? (0=false/1=true)
Bitte Formel eingeben:
Ergebnis: 10 + 2 = 12
Wollen sie den Rechner Starten? (0=false/1=true)
Bitte Formel eingeben:
Ergebnis: 10 / 2 = 5
Wollen sie den Rechner Starten? (0=false/1=true)
Bitte Formel eingeben:
Ergebnis: 10 * 2 = 20
Wollen sie den Rechner Starten? (0=false/1=true)
Bitte Formel eingeben:
Ergebnis: 10 - 2 = 8
Wollen sie den Rechner Starten? (0=false/1=true)
stderr
sh: 1: cls: not found
sh: 1: PAUSE: not found
sh: 1: cls: not found
sh: 1: PAUSE: not found
sh: 1: cls: not found
sh: 1: PAUSE: not found
sh: 1: cls: not found
sh: 1: PAUSE: not found