Hi, I am a total newbie to programming, so I do not know much about it. However I have created this very basic program which converts 2 currencies. I would appreciate it if I received some constructive criticism so I can improve my programming skills.
Thanks,
xka
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <windows.h>
int yGB();
int gbY();
using namespace std;
int main()
{
int opChoice;
cout << "Welcome to the currency converter \n\n\n";
Sleep(1000);
starto:
cout << "1. British sterling to Japanese Yen. \n";
cout << "2. Japanese Yen to British sterling. \n";
cin >> opChoice;
switch(opChoice)
{
case 1:
yGB();
break;
case 2:
gbY();
break;
default:
cout << " ERROR!ERROR!ERROR!ERROR!ERROR!ERROR!ERROR! \n\n";
Sleep(750);
goto starto;
break;
}
return 0;
system ("pause");
}
int yGB()
{
double gb;
double yen;
char sChoice;
cout << " Please enter the amount you want to convert: \n\n\n";
cin >> gb;
yen = gb * 149.2724;
cout << " The answer is: " << yen << "\n";
Sleep(500);
cout << " Would you like to go back to the menu? \n\n";
cin >> sChoice;
if ( sChoice == 'Y' || sChoice == 'y')
{
main();
}
else
if ( sChoice == 'N' || sChoice == 'n')
{
}
system("pause");
}
int gbY()
{
double gb;
double yen;
char sChoice;
cout << " Please enter the amount you want to convert: \n\n\n";
cin >> yen;
gb = yen/149.2724;
cout << " The answer is: " << gb << "\n";
Sleep(500);
cout << " Would you like to go back to the menu? \n\n";
cin >> sChoice;
if ( sChoice == 'Y' || sChoice == 'y')
{
main();
}
else
if ( sChoice == 'N' || sChoice == 'n')
{
getchar();
}
system("pause");
}