Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main(int argc, char *args[])
- {
- start:
- char mtype, again;
- float value, other_value;
- cout << "--------------------------------------------------------------------" << endl;
- cout << "Euro->Dollar->Euro [Umrechner von Euro zu Dollar und umgekehrt]" << endl;
- cout << "--------------------------------------------------------------------" << endl << endl;
- retype_mtype:
- cout << "Möchtest du den Euro- oder den Dollar-Betrag angeben? [e/d]: ";
- cin >> mtype;
- fflush(stdin);
- if (mtype != 'e' && mtype != 'd') goto retype_mtype;
- cout << endl << "Bitte gib einen Betrag in " << (mtype == 'e' ? ("Euro") : (mtype == 'd' ? ("Dollar") : (""))) << " an: ";
- cin >> value;
- fflush(stdin);
- switch (mtype)
- {
- case 'e': {
- other_value = value * 1.1f;
- break;
- }
- case 'd': {
- other_value = value / 1.1f;
- break;
- }
- }
- cout << endl << value << (mtype == 'e' ? (" Euro") : (mtype == 'd' ? (" Dollar") : (""))) << " sind umgerechnet " << other_value << (mtype == 'e' ? (" Dollar") : (mtype == 'd' ? (" Euro") : (""))) << endl;
- retype_again:
- cout << "Möchtest du noch mehr umrechnen? [y/n]: ";
- cin >> again;
- fflush(stdin);
- if (again != 'y' && again != 'n') goto retype_again;
- else if (again == 'y') goto start;
- else if (again == 'n') return(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement