Advertisement

02.22.2005 at 06:01PM PST, ID: 21325261
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.2

Currency converter with a menu and loop to give user to chose other currency until user decides to quit.

Asked by jbcoupet in Miscellaneous Programming

Tags: , , ,

I am trying to write a currency conversion using C programming. The program should contain a menu which displays the choice of currencies to be converted. The result should display something like this and it should loop until I decide to exit.
1) Mexican Pesos
2) Canadian Dollar
3) Euro
4) Japanese YEn
5) British Pound
6) Exit the program

Enter your selection (1-6) : 3
Enter the amount: 250

250 Euro = so much in US Dolllars.

Below is what I have done so far but no luck in getting the conversion. The program exits as soon as I pressed enter...look at below and help with the loop process and also the calculations,please. Thanks in advanced.

================================================================================


#include<stdio.h>
#include<stdlib.h>
      #define Swiss_Franc_rate 0.6072;       /*Swiss Franc rate*/
      #define British_Pounds_rate 1.4320;       /*British Pound rate*/
      #define Japanese_Yen_rate 0.0081;       /*Japanese Yen rate*/
      #define Canadian_Dollar_rate 0.6556;       /*Canadian Dollar rate*/
      #define Euros_rate 0.8923;


int main(void){
 
/*Declare floaters*/

float Swiss_Franc;            /*Swiss Franc*/
float British_Pounds;            /*British pounds*/
float Japanese_Yen;            /*Japanese Yen*/
float Canadian_Dollar;            /*Canadian Dollar*/
float Euros;                  /*European Union Euro*/
float USD;                  /*US Dollar*/
int   choice;

                    /*Title*/

printf("        Currency Conversion Program\n");

printf("----------------------------------------\n\n");


                   /*Menu*/

     printf("1)   Swiss Franc               \n");
     printf("2)   British Pound             \n");
     printf("3)   Japanese Yen              \n");
     printf("4)   Canadian Dollar           \n");
     printf("5)   Euro                      \n");
     printf("6)   Exit the Program          \n");

       
printf("\n");
printf("\n");

            /*Input from User*/

printf("Please enter your choice (1-6): ");
scanf("%d",&choice);

while((choice<1) || (choice>6)){
printf("Invalid entry, please Enter 1-6: ");
scanf("%i",&choice);
}
if(choice==1){
printf("Please the amount:  ");
scanf("%f",&Swiss_Franc);

      /*Conversion Calculation 1*/
Swiss_Franc = USD / Swiss_Franc_rate;

}
if(choice==2){
printf("Please enter the amount:  ");
scanf("%f",&British_Pounds);

      /*Conversion Calculation 2*/
British_Pounds = USD / British_Pounds_rate;
}

if(choice==3){
printf("Please enter the amount:  ");
scanf("%f",&Japanese_Yen);

      /*Conversion Calculation 3*/
Japanese_Yen = USD / Japanese_Yen_rate
}

if(choice==4){
printf("Please enter the amount:  ");
scanf("%f",&Canadian_Dollar);

      /*Conversion Calculation 4*/
Canadian_Dollar = USD / Canadian_Dollar_rate;
}

if(choice==5){
printf("Please enter the amount:  ");
scanf("%f",&Euros);

      /*Conversion Calculation 5*/
Euros = USD / Euros_rate;
}

if(choice==6){
printf("Exit the program:  ");

while (getchar() != '\n')
      continue;            
    goto top;              
  }                      
  printf("Goodbye!\n");
  return 0;

 }
    //Function
 
 void dashbar()                        
 {  
  int i = 1;                                  
  while (i < 50)                              
  {
     putchar ('-');                            
     i = i + 1;                              
  }
  putchar ('\n');                            
 }
Start Free Trial
 
 
[+][-]02.22.2005 at 08:38PM PST, ID: 13378913

View this solution now by starting your 14-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Miscellaneous Programming
Tags: currency, converter, conversion, loop
Sign Up Now!
Solution Provided By: zsabrina
Participating Experts: 2
Solution Grade: A
 
 
[+][-]02.22.2005 at 08:50PM PST, ID: 13378972

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.22.2005 at 09:42PM PST, ID: 13379235

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 14-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]02.24.2005 at 05:21AM PST, ID: 13392142

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 14-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]06.13.2005 at 06:11AM PDT, ID: 14201933

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 14-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]06.17.2005 at 05:44AM PDT, ID: 14240120

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 14-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-43