- Registriert
- Mai 2012
- Beiträge
- 918
Hallo,
wenn ich folgenden Code Compile:
Kommt kein Fehler raus Oo.
Aber wenn ich das Programm starte, egal welche Operation, kommt immer ein Ergebnis raus wie:
00401000.
Weiß jemand Rat? Wäre allen echt dankbar.
wenn ich folgenden Code Compile:
Code:
// Taschenrechner.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "stdio.h"
#include "windows.h"
#include "winuser.h"
#include "conio.h"
#include <iostream>
using namespace std;
int RechnenPlus(int Zahl1, int Zahl2, int Ergebnis){
Ergebnis = Zahl1 + Zahl2;
return Ergebnis;
};
int RechnenMinus(int Zahl1, int Zahl2, int Ergebnis){
Ergebnis = Zahl1 - Zahl2;
return Ergebnis;
};
int RechnenMal(int Zahl1, int Zahl2, int Ergebnis){
Ergebnis = Zahl1 * Zahl2;
return Ergebnis;
};
int RechnenGeteilt(int Zahl1, int Zahl2, int Ergebnis){
Ergebnis = Zahl1 / Zahl2;
return Ergebnis;
};
int _tmain(int argc, _TCHAR* argv[])
{
int Operation;
int ZahlA;
int ZahlB;
cout << "Wählen sire ihre Rechenoperation aus!" << endl;
cout << "1. Plus" << endl << "2. Minus" << endl << "3. Mal" << endl << "4. Geteilt" << endl;
cin >> Operation;
if(Operation==1){ //Plus
system("cls");
cout << "Geben sie ihre Zahlen ein!" << endl;
cin >> ZahlA;
cin >> ZahlB;
RechnenPlus(ZahlA, ZahlB, false);
cout << RechnenPlus << endl;
system("pause");
}
if(Operation==2){ //Minus
system("cls");
cout << "Geben sie ihre Zahlen ein!" << endl;
cin >> ZahlA;
cin >> ZahlB;
RechnenMinus(ZahlA, ZahlB, false);
cout << RechnenMinus << endl;
system("pause");
}
if(Operation==3){ //Mal
system("cls");
cout << "Geben sie ihre Zahlen ein!" << endl;
cin >> ZahlA;
cin >> ZahlB;
RechnenMal(ZahlA, ZahlB, false);
cout << RechnenMal << endl;
system("pause");
}
if(Operation==4){ //Geteilt
system("cls");
cout << "Geben sie ihre Zahlen ein!" << endl;
cin >> ZahlA;
cin >> ZahlB;
RechnenGeteilt(ZahlA, ZahlB, false);
cout << RechnenGeteilt << endl;
system("pause");
}
_getch();
return 0;
}
Aber wenn ich das Programm starte, egal welche Operation, kommt immer ein Ergebnis raus wie:
00401000.
Weiß jemand Rat? Wäre allen echt dankbar.
Zuletzt bearbeitet:
(Frage vergessen Oo)