I Having Problems with my program. I hope someone will help me with my problems.
By the way, I need help regarding Going Back to Menu using Loop.
Thank you very much!
if you have seen any problems, please post your message. Thanks!
#include <stdio.h>
void main()
{
float usd, php, jpy, bad, gbp, sar, cyn, sfk, hkd, aud, cad, eur;
char mchoice, choice;
int pchoice;
clrscr();
gotoxy(33,1);
start:
printf("\nCurrency Converter\n");
printf("================================================================================");
printf("Please select your choice: \n");
printf("[a] Preffered Convertible Currency to PHP\n");
printf("[b] USD to All Currencies\n");
printf("[c] PHP to Preffered Currency\n");
printf("[d] PHP to All Currencies\n");
printf("[e] About the Program\n");
printf("[x] Exit the Program\n");
printf("Please enter you choice: ");
scanf("%c",&mchoice);
switch (mchoice)
case 'a':
case 'A':
{
printf("\n1. USD to PHP\n");
printf("2. JPY to PHP\n");
printf("3. BAH to PHP\n");
printf("4. GBP to PHP\n");
printf("5. SAR to PHP\n");
printf("6. AUD to PHP\n");
printf("7. Euro to PHP\n");
printf("8. CYN to PHP\n");
printf("9. HKD to PHP\n");
printf("10. SFC to PHP\n");
printf("Please Enter Your Preffered Currency Conversion From The Menu: \t");
scanf("%d",&choice);
switch(choice)
{
case 1:
printf("\n\nUSD to PHP:\n\n");
printf("Please Enter USD Amount to be Converted: \t");
scanf("%f",&usd);
printf("\n%.2f US Dollars is equal to %.2f Pesos",usd ,usd * 44.24);
getch();
clrscr();
goto start;
case 2:
printf("\n\nJPY to PHP:\n\n");
printf("Please Enter Japan Yen to be Converted: \t");
scanf("%f",&jpy);
printf("\n%.2f Japan Yen is equal to %.2f Pesos",jpy ,jpy * 0.576);
break;
case 3:
printf("\n\Bahrain Dinar to PHP:\n\n");
printf("Please Enter BAH Amount to be Converted: \t");
scanf("%f",&bad);
printf("\n%.2f Bahrain Dinar is equal to %.2f Pesos",bad ,bad * 117.4007);
break;
case 4:
printf("\n\nGBP to PHP:\n\n");
printf("Please Enter UK Pounds Amount to be Converted: \t");
scanf("%f",&gbp);
printf("\n%.2f UK Pounds is equal to %.2f Pesos",gbp ,gbp * 68.41);
break;
case 5:
printf("\n\nSAR to PHP:\n\n");
printf("Please Enter SAR Amount to be Converted: \t");
scanf("%f",&sar);
printf("\n%.2f Saudi Arabian Rial is equal to %.2f Pesos",sar ,sar * 11.78);
break;
case 6:
printf("\n\nAUD to PHP:\n\n");
printf("Please Enter AUD Amount to be Converted: \t");
scanf("%f",&aud);
printf("\n%.2f Australian Dollars is equal to %.2f Pesos",aud ,aud * 45.2991);
break;
case 7:
printf("\n\nEUR to PHP:\n\n");
printf("Please Enter Euro Amount to be Converted: \t");
scanf("%f",&eur);
printf("\n%.2f Euros is equal to %.2f Pesos",eur ,eur * 56.4933);
break;
case 8:
printf("\n\nCYN to PHP:\n\n");
printf("Please Enter China Yuan Amount to be Converted: \t");
scanf("%f",&cyn);
printf("\n%.2f China Yuan is equal to %.2f Pesos",cyn ,cyn * 7.0069);
break;
case 9:
printf("\n\nHKD to PHP:\n\n");
printf("Please Enter HKD Amount to be Converted: \t");
scanf("%f",&hkd);
printf("\n%.2f US Dollars is equal to %.2f Pesos",hkd ,hkd * 5.6979);
break;
case 10:
printf("\n\nSFK to PHP:\n\n");
printf("Please Enter SFK Amount to be Converted: \t");
scanf("%f",&sfk);
printf("\n%.2f Swiss Francs is equal to %.2f Pesos",sfk ,sfk * 46.5894);
break;
}
case 'b':
printf("Please enter the US Dollar Amount: ");
scanf("%f", &usd);
printf("\n\nHere's the Conversion of US Dollar to Other Currencies:\n\n");
printf("\nJapanese Yen (JPY): %2.f",usd * 0.013);
printf("\nGreat Britain Pound (GBP): %.2f",usd * 1.546);
printf("\nBahrain Dinar: %.2f",usd * 117.4007);
printf("\nSaudi Arabian Rial (SAR): %.2f",usd * 0.266);
printf("\nAustralian Dollars: %.2f",usd * 45.2991);
printf("\nEuros: %.2f",usd * 56.4933);
printf("\nChina Yuan: %.2f",usd * 7.0069);
printf("\nHong Kong Dollars: %.2f",usd * 5.6979);
printf("\nSwiss Francs: %.2f",usd * 46.5894);
case 'c':
printf("\n[1]. PHP to USD\n");
printf("[2]. PHP to JPY\n");
printf("[3]. PHP to BAH\n");
printf("[4]. PHP to GBP\n");
printf("[5]. PHP to SAR\n");
printf("[6]. PHP to AUD\n");
printf("[7]. PHP to Euro\n");
printf("[8]. PHP to CYN\n");
printf("[9]. PHP to HKD\n");
printf("[10].PHP to SFC\n");
printf("Please Enter Your Preffered Currency Conversion From The Menu: \t");
scanf("%d",&pchoice);
switch(pchoice)
{
case 1:
printf("\n\nPHP to USD:\n\n");
printf("Please Enter PHP Amount to be Converted: \t");
scanf("%f",&php);
printf("\n%2f Pesos is equal to %.2f US Dollars",php, php / 44.24);
case 2:
printf("\n\nPHP to JPY:\n\n");
printf("Please Enter PHP Amount to be Converted: \t");
scanf("%f",&php);
printf("\n%2f Pesos is equal to %.2f Japan Yen",php, php / 0.576);
case 3:
printf("\n\PHP to Bahrain Dinar:\n\n");
printf("Please Enter PHP Amount to be Converted: \t");
scanf("%f",&php);
printf("\n%.2f Pesos is equal to %.2f Bahrain Dinar",php ,php / 117.4007);
case 4:
printf("\n\nPHP to GBP:\n\n");
printf("Please Enter PHP Amount to be Converted: \t");
scanf("%f",&php);
printf("\n%.2f Pesos is equal to %.2f UK Pounds",php ,php / 68.41);
case 5:
printf("\n\nPHP to SAR:\n\n");
printf("Please Enter PHP Amount to be Converted: \t");
scanf("%f",&php);
printf("\n%.2f Pesos is equal to %.2f Saudi Arabian Rial",php, php / 11.78);
case 6:
printf("\n\nPHP to AUD:\n\n");
printf("Please Enter PHP Amount to be Converted: \t");
scanf("%f",&php);
printf("\n%.2f Pesos is equal to %.2f Australian Dollars",php, php / 45.2991);
case 7:
printf("\n\nEPHP to EUR:\n\n");
printf("Please Enter PHP Amount to be Converted: \t");
scanf("%f",&php);
printf("\n%.2f Pesos is equal to %.2f Euros",php, php / 56.4933);
case 8:
printf("\n\nPHP to CYN:\n\n");
printf("Please Enter PHP Amount to be Converted: \t");
scanf("%f",&php);
printf("\n%.2f Pesos is equal to %.2f China Yuan",cyn ,cyn / 7.0069);
case 9:
printf("\n\nPHP to HKD:\n\n");
printf("Please Enter PHP Amount to be Converted: \t");
scanf("%f",&php);
printf("\n%.2f Pesos is equal to %.2f Hong Kong Dollars",php, php / 5.6979);
case 10:
printf("\n\nSFK to PHP:\n\n");
printf("Please Enter PHP Amount to be Converted: \t");
scanf("%f",&php);
printf("\n%.2f Pesos is equal to %.2f Swiss Francs",php, php / 46.5894);
default: printf("Wrong Input!");
getch();
clrscr();
goto start;
}
case 'd':
printf("\nPlease enter the Philippine Peso Amount: ");
scanf("%f", &php);
printf("\n\nHere's the Conversion of Philippine Peso to Other Currencies:\n\n");
printf("\nJapanese Yen (JPY): %.2f",php / 0.013);
printf("\nGreat Britain Pound (GBP): %.2f",php / 1.546);
printf("\nBahrain Dinar: %2f",php ,php / 117.4007);
printf("\nSaudi Arabian Rial (SAR): %.2f",php / 0.266);
printf("\nAustralian Dollars: %.2f",php/ 45.2991);
printf("\nEuros: %.2f",php / 56.4933);
printf("\nChina Yuan: %.2f",php / 7.0069);
printf("\nHong Kong Dollars: %.2f",php / 5.6979);
printf("\nSwiss Francs: %.2f",php / 46.5894);
case 'x':
printf("The program will now terminate! Bye Bye!");
getch();
return 0;
default: printf("Wrong Input!");
getch();
clrscr();
goto start;
}
getch();
}