Convert Different Currencies to Hungarian Forints
Create a program that reads lines containing amounts expressed in U.S. dollars, G. B. Pounds, Euros, or Hungarian Forints from the standard input and converts it to Hungarian Forint with the following exchange rates:
Each input line consists of a positive integer, a space, and the currency: “EUR”, “GBP”, “HUF”, or “USD”.
The number of input lines are not restricted but the amounts in each line can be stored in a variable type
For each input line, print one line to the output containing the same amount expressed in Hungarian Forint. Finally print one extra line containing the grand total.
The output follows the format of the input except that the lines end with the word “HUF”.
Output for Sample Input
Hints and Guide
This exercise can be easily solved by using the standard input-output library. While the
The exercise describes a strict input format. Note that there is no need to take care of the cases when the input does not follow its specification.
We can easily solve the exercise line by line. After reading an input line, for example with the help of the
One possible solution is available in: main.c.
Acknowledgement This work was supported by the construction EFOP-3.4.3-16-2016-00021. The project was supported by the European Union, co-financed by the European Social Fund.
|University of Debrecen; Faculty of Informatics; v. 03/01/2019|