Currency Converter Program in C++
Currency conversion is an everyday life problem. We have to convert the currencies in our daily routine. So if someone like to develop a C++ program to convert the currencies than this program is best to take help from it.
If you have programmed already in some programming languages, then you surely have made the currency converter program in C language, python, java etc.
But, If you are a beginner just stay here and you will master how to create the c++ currency converter.
I will never recommend to just copy and paste the code from here, my advice is to just grab the concept from here and write the code himself. It will improve your programming practice.
Currency to
Convert
We
are going to convert the dollars in British Pounds, French Franc, German Dutch
and Japanese Yen. This question is also given in some of the text book, this
program is just right solution of the textbook question as well.
How to Do
We
will declare the four variables as four currencies as Dollars, Pounds, Franc,
Dutch and Yen as a float data type.
We will take the dollars from user as an input and the rate of dollars in other currencies will be fixed in the program by programmer.
When user will enter the dollars, program will simply multiply the rate with number of dollars and gave the converted currencies to user as output. That’s it.
Currency
Converter Program in C++
Code
#include<iostream>
using
namespace std;
int
main()
{
float dollar;
float bp=(1/1.487);
float frnc=(1/0.172);
float dutchmark=(1/0.584);
float yen=(1/0.00955);
cout<<"Enter the Dollars
for Conversion :\n";
cin>>dollar;
cout<<"British Pounds
:"<<bp*dollar<<endl;
cout<<"French franc
:"<<frnc*dollar<<endl;
cout<<"German Dutchmark
:"<<dutchmark*dollar<<endl;
cout<<"Japanese Yen
:"<<yen*dollar<<endl;
return 0;
}
Output
On running this program user will interact with this program in the following way to solve his problem. Below is the general scenario.
How we have
done
we have declared the dollars, bp, franc, dutchmark and yen as float variables and fixed their rate. You can also fixed current rates but we have adjust the rates which are given in textbook question. Then we have print a statement to ask user to enter dollars. User has entered the dollars which we have stored in the variable dollar. In the next four statement we have display the converted currencies by just multiplying the rate with no of dollars.
You May Also Like
Currency Converter Program in Java
Currency Converter Program in Python
Thanks
to Join the SoftOSet.
Reset
Your Technology.
I encourage you to read this text it is fun described ... google currency converter
ReplyDeleteI have a similar interest this is my page read everything carefully and let me know what you think. converter currency
ReplyDeletePost a Comment
Feel Free to Comment Us