OtherPapers.com - Other Term Papers and Free Essays
Search

C Programming - Currency Converter

Essay by   •  January 2, 2012  •  Study Guide  •  4,276 Words (18 Pages)  •  1,807 Views

Essay Preview: C Programming - Currency Converter

Report this essay
Page 1 of 18

#include<stdio.h>

#include<conio.h>

main()

{

int choice;

float amt;

float result;

printf("nn *******!!Currency Converter!!*******nnn Press Any Key To Continue:");

getch();

printf("nn ****Choose the currency you are using**** nPush 1 for Dollars. nPush 2 for Pounds. nPush 3 for Naira. nPush 4 for Cedies. nPush 5 for Yen. nPush 6 for Yuan Renminbi.n", &choice);

scanf("%d",&choice);

if (choice == 1){

float usd[5] = {162.200,1.63700,77.9459,0.639420,6.31880};

printf(" ******Please type in your amount of Money****** n",&amt);

scanf("%f",&amt);

printf(" ******_To Convert To_****** nNaira Push 1. nCedies Push 2. nYen(Japan) Push 3. nPounds Push 4. nYuan Renminbi Push 5.",&choice);

getch();

scanf("%d",&choice);

if (choice == 1){

result= amt*usd[0];

printf("Your Result is %f ",&result);

}

else if (choice == 2){

result=amt*usd[1];

printf("Your Result is %f ",&result);

}

else if (choice == 3){

result=amt*usd[2];

printf("Your Result is %f ",&result);

}

else if (choice == 4){

result = amt*usd[3];

printf("Your Result is %f ",&result);

}

else if (choice == 5){

result = amt*usd[4];

printf("Your Result is %f ",&result);

}

else if (choice == 6){

result = amt*usd[5];

printf("Your Result is %f ",&result);

}

else {

printf("*!*!*!*!Wrong input!*!*!*!*");

getch();

}

}

else if (choice == 2){

float gbp[5] = {253.528,2.55911,121.896,1.56392,9.88171};

printf(" ******Please type in your amount of Money****** n",&amt);

scanf("%f",&amt);

printf(" ******_To Convert To_****** nNaira Push 1. nCedies Push 2. nYen(japan) Push 3. nDollars Push 4. nYuan Renminbi(China) Push 5.",&choice);

getch();

scanf("%d",&choice);

if (choice == 1){

result= amt*gbp[0];

printf("Your Result is %f ",&result);

}

else if (choice == 2){

result=amt*gbp[1];

printf("Your Result is %f ",&result);

}

else if (choice == 3){

result=amt*gbp[2];

printf("Your Result is %f ",&result);

}

else if (choice == 4){

result = amt*gbp[3];

printf("Your Result is %f ",&result);

}

else if (choice == 5){

result = amt*gbp[4];

printf("Your Result is %f ",&result);

}

else if (choice == 6){

result = amt*gbp[5];

printf("Your Result is %f ",&result);

}

else {

printf("*!*!*!*!Wrong input!*!*!*!*");

getch();

}

}

else if (choice == 3){

float ngn[5] = {0.00616523,0.0100925,0.480470,0.00394434,0.0389568};

printf(" ******Please type in your amount

...

...

Download as:   txt (9.3 Kb)   pdf (95.9 Kb)   docx (10.6 Kb)  
Continue for 17 more pages »
Only available on OtherPapers.com