F
Frasch
Bekanntes Mitglied
Hallo,
Ich wollte als kleine Übung mal einen Taschenrechner schreiben aber er findet immer einen fehler.
könnt ihr mir bitte weiterhelfen?
Ich wollte als kleine Übung mal einen Taschenrechner schreiben aber er findet immer einen fehler.
könnt ihr mir bitte weiterhelfen?
Code:
#include <cstdlib>
#include <iostream>
#include <conio.h>
using namespace std;
void addition();
{
int zahl1, zahl2;
cout << "Sie haben die Addition gewählt" << endl;
cout << "Zahl 1: " << endl;
cin >> zahl1;
cout << "Zahl 2: " << endl;
cin >> zahl2;
cout << "Ergebnis: " << (zahl1 + zahl2) << endl;
}
void subtraktion();
{
int zahl1, zahl2;
cout << "Sie haben die Subtraktion gewählt" << endl;
cout << "Zahl 1: " << endl;
cin >> zahl1;
cout << "Zahl 2: " << endl;
cin >> zahl2;
cout << "Ergebnis: " << (zahl1 - zahl2) << endl;
}
void multiplikation();
{
int zahl1, zahl2;
cout << "Sie haben die Multiplikation gewählt" << endl;
cout << "Zahl 1: " << endl;
cin >> zahl1;
cout << "Zahl 2: " << endl;
cin >> zahl2;
cout << "Ergebnis: " << (zahl1 * zahl2) << endl;
}
void division();
{
int zahl1, zahl2;
cout << "Sie haben die Division gewählt" << endl;
cout << "Zahl 1: " << endl;
cin >> zahl1;
cout << "Zahl2 : " << endl;
cin >> zahl2;
cout << "Ergebnis: " << (zahl1 / zahl2) << endl;
}
int main(int argc, char *argv[])
{
int ents;
cout << "1. Addition" << endl;
cout << "2. Subtraktion" << endl;
cout << "3. Multiplikation" << endl;
cout << "3. Division" << endl;
cin >> ents;
if (ents == 1) addition();
if (ents == 2) subtraktion();
if (ents == 3) multiplikation();
if (ents == 4) division();
getch()
}