Discussion:
Describe the below code:
#Include
/*
Name :
Assignment :
Date final Compile : 03 12 2006
Comments: Program displays "Hello world"
Version control Displays 1.1.01
Q: Write an English narrative that converts currency. The narrative should display a title, "Currency Conversion" and then write the names of currencise and exchange rates. Allow the user to select a country and exchange rate from a menue.
Allow the user to designate the amount of dollars to exchange. The exchanged amounts are displayed. Repeat this process until the users desires to stop.
You may use any nouns that you want, but restrict your verbs to the following :input, display, add, multiply, and repeat. If you feel that you have to use another verb, you must contact me first. Be sure and remember to keep Input information/ Processing /output information separate. Do not mix them. Your submission should read like an english paragraph, and not like a programming language.
Use the course,s C compiler, write a C Program that contains your narrative from this week broken down into one line sentences, that have been commented out. Use the sample program from last week as your template.
/*
/*Include Standard Input and output directory*/
#include
/*Start of the main the function*/
main(){
/* Declare variables to input amount and store conversion value from user*/
float amount,conversion;
unsigned int choice;
/*Clear the screen */
clrscr();
/* Print the heading */
printf("Currency Conversion\n");
/* Repeat till user wants to Quit*/
do{
/* Display options to user*/
/* Display options for converting Dollars to Pounds*/
printf("1. Convert US dollars into Pounds at the rate of 1 pound = 1.5 dollars\n");
/* Display options for converting Dollars to Euros*/
printf("2. Convert US dollars into Euro at the rate of 1 Euro = 2 dollars\n");
/* Display options for user to quit*/
printf("3. Quit the service\n");
/* Input user choice */
printf("Please enter your choice: ");
scanf("%ud",&choice);
/* Input the amount if user wants currency conversion*/
if(choice!=3)
{
printf("Please enter amount of US dollars to exchange : ");
scanf("%f",&amount);
}
switch(choice)
{
case 1:
/* Find equivalent currency in Pounds and display*/
printf("Equivalent of %f US dollars is %f Pounds\n\n",amount, amount/1.5);
break;
case 2:
/* Find equivalent currency in Euros and display*/
printf("Equivalent of %f US dollars is %f Euros\n\n",amount, amount/2);
break;
case 3:
/* If user wants to QUIT display thanking message*/
printf("Thank You for using Currency Conversion Service..Press a key to exit");
break;
default:
/* Display */
printf("Invalid Input");
}
}
/* If user don't want to quit continue*/
while(choice!=3);
getch();
}