#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    17
    Rep Power
    0

    Help taking the next step


    I am trying to work out how I take the result from the question asked in the below code and then do a calculation I am a bit stuck. I have compiled this and it seems to work

    When you run it asks for a corresponding letter to be entered to know which currency you want to convert to US$. you can enter the letter but from there I am a bit stuck.

    What I am trying to do is once you have entered the letter it says so you want to convert to x to US$, at an exchange rate of y.

    Then it asks you the question how many x's do you want to convert to US$

    The user then enters the amount and the answer is returned

    I just need to know which step to learn next I am not asking someone to do it for me.

    #include <stdio.h>

    int a =2;
    int b =4;
    int c =6;
    int d =8;
    char name[20];
    main()
    {

    printf("\n Enter the letter1 of the currency you ");
    printf("\n want to convert into US$");
    printf("\n a = Australian dollars.");
    printf("\n b = British Pounds.");
    printf("\n c = Japenes yen.");
    printf("\n d = Vitnames dollars.");
    printf(" Enter amount to convert: ");
    scanf("%i");


    return 0;
    }
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Location
    /dev/null
    Posts
    163
    Rep Power
    19
    One way is to write a set of if-else if statements. Another way is to write a switch case statement. Learn how to write switch case statements.

IMN logo majestic logo threadwatch logo seochat tools logo