# c programming question?

## can someone help me do this I am stuck at req- 6 question. From 6.1- 6.4

• ### .

• Total voters
0

#### moe

Registered Member
In this assignment, you will write a simple Currency Converter using C string functions. The program can do the followings:

REQ-1. Show a Main menu, then read a digit from the keyboard. Example output:
======= MAIN ========
0 - EXIT
1 - Exchange
2 - Update Rates
3 - List Rates
4 - List Currencies
=====================

REQ-2. If the digit is not 0-4, for example “5”, show an Error message, then show the Main menu again. Example output:

== Your input is INVALID! ==

REQ-3. If the digit is “4”, show a “Currencies” list, then show the Main menu. Example output:

===== Currencies ======
USD - US Dolloar
EUR - Euro
GBP - British Pound
=====================

REQ-4. If the digit is “3”, show a “Rates” table, then show the Main menu. Example output:

USD 1.000 1.268 0.857 0.758

EUR 1.167 1.479 1.000 0.884

GBP 1.319 1.720 1.131 1.000

REQ-5. If the digit is “2”, show an “Update Exchange Rate” prompt, then read a line from the keyboard. Example output:

== Update Exchange Rate ==

5.1 If the input line is not in the required format, for example “1” or “cad”, show an Error message, and then show the “Update Exchange Rate” prompt again. Example output:

== Your input is INVALID! ==

5.2 If the input line is in the correct format of lower cases, for example “cad/usd=0.788”, show the exchange rates, then show the Main menu. Example output:

1 Canadian Dollar <==> 0.788 US Dolloar
1 US Dolloar <==> 1.269 Canadian Dollar

5.3 If the input line is in the correct format of upper cases, for example “CAD/EUR=0.677“, show the exchange rates, then show the Main menu. Example output:

1 Canadian Dollar <==> 0.677 Euro
1 Euro <==> 1.477 Canadian Dollar

5.4 Now check if the rates have been correctly updated, by giving a “3” to the Main menu (as in REQ-4 above), an updated “Rates” table should be shown. Example output:

USD 1.000 1.269 0.857 0.758

USD CAD EUR GBP USD 1.000 1.269 0.857 0.758 CAD 0.788 1.000 0.677 0.598 EUR 1.167 1.477 1.000 0.884 GBP 1.319 1.720 1.131 1.000

REQ-6. If the digit is “1”, show a “Currency Converting” prompt, then read a line from the keyboard. Example output:

== Example: how much is 100 cad in usd? ==
>>

6.1 If the input line is not in the required format, for example “a”, “hello world!”, “how much is aaa cad in usd?”, or “how much is 100 cad in uuu?”, show an Error message, and then show the “Currency Converting” prompt. Example output:

== Your input is INVALID! ==

6.2 If the input line is in the correct format of lower cases, for example “how much is 100 cad in usd?”, show the exchange result, and then show the “Currency Concerting” prompt. Example output:

== 100.00 Canadian Dollar is 78.80 in US Dolloar. ==

6.3 If the input line is in the correct format of upper cases, for example “how much is 123 CAD in EUR?”, show the exchange result, and then show the “Currency Concerting” prompt. Example output:

== 123.00 Canadian Dollar is 83.27 in Euro. ==

6.4 If the input is “q” or “Q”, then show the Main menu.

REQ-7. Finally, if the digit is “0”, show a “Good-Bye” message, and then exit the program. Example output:

== Thank you, See you next time! ==

That seems an odd place to be stuck. Why don't you post your work, so we can take a look?

// there is some syntax errors, but this is what i got

#include <stdio.h>

int main()

{

{

float convert, converted;

float USD_USD =1.000, USD_CAD = 1.269, USD_EUR = 0.857, USD_GBP =0.758;

int choice;

printf("=======MAIN=======\n\n");

printf("0. Exit\n");

printf("1. Exchange\n");

printf("2. Update Rates\n");

printf("3. List Rates\n");

printf("4. List Currencies\n\n");

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

scanf("%d", &choice);

if (choice ==5)

{

}

if (choice ==4)

{

printf("====Currencies====\n\n");

printf("USD - US Dolloar\n");

printf("EUR - EURO\n");

printf("GRP - Brittish Pound\n");

}

if (choice ==3)

{

printf("\n: USD CAD EUR GBP ");

printf("\n: USD: %f %f %f %f ", USD_USD,USD_CAD,USD_EUR,USD_GBP);

printf("\n: EUR: %f %f %f %f ",EUR_USD,EUR_CAD,EUR_EUR,EUR_GBP);

printf("\n: GPB: %f %f %f %f ",GBP_USD,GBP_CAD,GBP_EUR,GBP_GBP);

}

if (choice ==2)

{

printf("==Update Exchange Rate\n");

{

}

{

}

}

return 0;

}

What happens if choice = 6?

What happens if choice = 6?
any number that isn't 0-4 then the program should give an error message and then give the main menu of the choices they have.

any number that isn't 0-4 then the program should give an error message and then give the main menu of the choices they have.
That's not what your code does...