All pastes #422628 Raw Edit

Taschenrechner v1.0

public cpp v1 · immutable
·published 2007-04-03 16:12 UTC
rendered paste body
#include <cstdlib>#include <iostream>#include <string>using namespace std;float Addition() {    float Zahl;    float Ergebnis;    string Option("ja");    do {        cout<<"Zahl eingeben"<<endl;        cin>>Zahl;        cout<<"Zahl eingeben"<<endl;        cin>>Ergebnis;        Ergebnis=Ergebnis+Zahl;        cout<<"Weiterrechnen?(ja/nein)"<<endl;        cin>>Option;        }    while(Option=="ja");    cout<<Ergebnis<<endl;}float Subtraktion() {    float Zahl1;    float Zahl2;    string Option("ja");    cout<<"Zahl eingeben"<<endl;    cin>>Zahl2;    do {        cout<<"Zahl eingeben"<<endl;        cin>>Zahl1;        Zahl2=Zahl2-Zahl1;        cout<<"Weiterrechnen?(ja/nein)"<<endl;        cin>>Option;        }    while(Option=="ja");    cout<<"Ergebnis:"<<Zahl2<<endl;}float Multiplikation() {    float Zahl1;    float Zahl2;    string Option("ja");    cout<<"Zahl eingeben"<<endl;    cin>>Zahl2;    do {        cout<<"Zahl eingeben"<<endl;        cin>>Zahl1;        Zahl2=Zahl2*Zahl1;        cout<<"Weiterrechnen?(ja/nein)"<<endl;        cin>>Option;        }    while(Option=="ja");    cout<<"Ergebnis:"<<Zahl2<<endl;}float Division() {    float Zahl1;    float Zahl2;    string Option("ja");    cout<<"Zahl eingeben"<<endl;    cin>>Zahl2;    do {        cout<<"Zahl eingeben"<<endl;        cin>>Zahl1;        Zahl2=Zahl2/Zahl1;        cout<<"Weiterrechnen?(ja/nein)"<<endl;        cin>>Option;        }    while(Option=="ja");    cout<<"Ergebnis:"<<Zahl2<<"\n.\n.\n."<<endl;}int main(int argc, char *argv[]){  Anfang:      int Auswahl;    cout<<"Um nach der Rechnung weiterzurechnen, geben sie \"ja\" ein,\num das Ergebnis zu erhalten, tippen sie \"nein\".\n"<<endl;    cout<<"Druecken sie\n1 fuer Addition,\n2 fuer Subtraktion,\n3 fuer Multiplikation,\n4 fuer Division."<<endl;    cin>>Auswahl;    switch(Auswahl) {                    case 1:                         Addition();                         break;                    case 2:                         Subtraktion();                         break;                    case 3:                         Multiplikation();                    case 4:                         Division();                    }    goto Anfang;                    system("PAUSE");    return EXIT_SUCCESS;