Verwirrt durch den Taschenrechnerprogramm
-
Hallo liebe C++ Community

Ich bin dabei ein taschenrechner mit den 4 Grundfunktionen(Addieren,subtrahieren....ect.)
zu schreiben.
Leider bekomme ich von meinem Compiler immer 8 Fehler angeziegt,die ich nicht weiß zu berichtigen.#include <iostream.h> int add (int a, int b) { int c = a+b; return c; } int Sub (int a,int b) { int c = a-b; return c; } int Mal (int a,int b) { int c =a*b; return c; } int Div (int a, int b) { int c = a/b; return c; } int main() { cout<<"Willkommen zum Taschenrechner von x-r4y!\n"; cout<<"Geben Sie einen Wert ein>!\n"; int Zahl1; cin >>Zahl1; cout <<"Geben Sie den nächsten Wert ein!\n"; int Zahl2; cin >> Zahl2; cout <<"Wert1= " <<Zahl1<<"\n"; cout <<"Wert2= " <<Zahl2<<"\n"; cout<< "\n\n" ; cout<<"Geben Sie die Rechenoperaton ein! \n"; cout<<"Zahl Addition =1\n"; cout<<"Zahl Subtraktion =2\n"; cout<<"Zahl Multiplikation=3\n"; cout<<"Zahl Division=4\n"; cout<<"--------------\n\n"; cout<<"Ihre Eingabe....: " ; int op; cin>>op ; if (op==1) { cout<<"Die Summe der Zahlen betraegt:"; cout<<"add (Zahl1,Zahl2); cout<< "\n\n\n"; } else if (op==2) { cout<<"Die Subtraktion der Zahlen betraegt: "; cout<<"Sub (Zahl1,Zahl2); cout<<"\n\n\n"; } else if (op==3) { cout<< "Die Multiplikation der Zahlen betraegt: " ; cout<<"Mal (Zahl1,Zahl2); cout<<"\n\n\n"; } else if (op==4) { cout<< "Die Division der Zahlen betraegt: " ; cout<<"Div (Zahl1,Zahl2) cout<<"\n\n\n"; } else if (op>4) { cout<<"Falsche Eingabe!\n"; } cout<<"Danke by x-r4y\n"; return 0 ; }Das ist mein Code.
Fehler sind:51 Tschenrechner.cpp
stray '\' in program51 Taschenrechner.cpp
stray '\' in program51 Taschenrechner.cpp
stray '\' in program51 Taschenrechner.cpp
stray '\' in program56 Taschenrechner.cpp
parse error before `Subtraktion'64 Taschenrechner.cpp
stray '\' in program64 Taschenrechner.cpp
stray '\' in program64 Taschenrechner.cpp
stray '\' in program68 Taschenrechner.cpp
parse error before `Division'51 Taschenrechner.cpp
stray '\' in programWürde mich echt freuen ,wenn ihr mir sagt ,wie ich das berichtigen muss.
-
Dieser Thread wurde von Moderator/in SideWinder aus dem Forum DOS und Win32-Konsole in das Forum C++ verschoben.
Im Zweifelsfall bitte auch folgende Hinweise beachten:
C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?Dieses Posting wurde automatisch erzeugt.
-
Hi!
Du hast jeweils ein " zu viel: cout<<**"**Mal (Zahl1,Zahl2);.
grüße