Selasa, 13 Disember 2011
grrr..ini pembetulan yang ana buat salah semalam...
tapi tak sure la betul ke tak... nanti hari khamis ana comform kan betul ke tak..
tapi at least ana dah cuba jawab sendiri kan..kan...
k...ini soalan nye...
Foreign currency converter C code programming.
Write a computer program in C which will request the user to enter a number representing the amount of foreign currency he/she would like to exchange to Malaysia Ringgit (MYR). Your program is interactive and so should work for any input amount from the user.
The foreign currencies which involve in your converter C Code program are Singapore Dollar (SGD), US Dollar (USD), Great Britain Pound (GBP) and Euro (EUR).
Your program should output the foreign currency conversion, showing how much of each type of foreign currency can be obtained for the amount the user enters.
Below is the latest currency rate as per 6th December 2010.
1 SGD = 2.44009 MYR
1 USD = 3.16501 MYR
1 GBP = 4.99246 MYR
1 EUR = 4.25645 MYR
The program should read the SGD, USD, GBP and EUR as float. Use float to represent the amount in MYR. Use the formatting code %.2f to display the outputs in two decimal digits.
Use #define to give meaningful names to significant constants. In particular, the relationships between MYR and SGD, USD, GBP and EUR should be given names using #define, not written directly into expressions in your program.
You may not use conditional statements or loops (if, while, for, etc.) in this lab exercise. The program can be written using only input and output plus assignment statements.