C++ code for Currency converter (with algorithm)


Here is the C++ code for currency converter . It converts american dollars to British pounds, Mexican pesos, Japanese yen and Pakistani rupees. You all should have in mind how it works exactly. Here is the algorithm.

  Steps
User side
1: User asked to enter money in American dollars, so he input the money.
2: Screen displays result in the following currencies : British pounds, Mexican pesos, Japanese yen and Pakistani rupees.
Developer side
1: Declare variables that are going to be used in program (one int for input and 4 float for results ).
2: Input money using  "cin" in an int variable
3: Convert into British pounds using following formula  British pounds=American dollars*0.571505
4: Convert into Mexican pesos using following formula  Mexican pesos=American dollars*10.7956
5: Convert into Japanese yen using following formula  Japanese yen=American dollars*112.212
6: Convert into Pakistani rupees using following formula  Pakistani rupees=American dollars*102.243
7: Display all
Code:


#include<iostream>
using namespace std;
void main()
{      //Declaration of varibles
       int dollars;
       float B,M,J,P;
       //input American dollars
       cout<<"Enter currency in American Dollars"<<endl;
       cin>>dollars;
       //Calculations
       B=dollars*0.571505;
       M=dollars*10.7956;
       J=dollars*112.212;
       P=dollars*102.243;
       cout<<dollars<<"American dollars are equal to "<<B<<" British pounds"<<endl;
       cout<<dollars<<"American dollars are equal to "<<M<<" Mexican pesos"<<endl;
       cout<<dollars<<"American dollars are equal to "<<J<<" Japanese yen"<<endl;
       cout<<dollars<<"American dollars are equal to "<<P<<" Pakistani rupees"<<endl;

       system("pause");
}

Output:

Comments

  1. This comment has been removed by the author.

    ReplyDelete
  2. You are great with words. I enjoyed this and I will be back for more.Gold And Silver Dealers In San Francisco

    ReplyDelete
  3. I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me..Mconvert Thanks for all your help and wishing you all the success in your business.

    ReplyDelete
  4. Superbly written article, if only all bloggers offered the same content as you,£29.99 the internet would be a far better place..

    ReplyDelete
  5. I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me to start my own Blog Engine blog now. Really the blogging is spreading its wings rapidly. Your write up is a fine example of it. xbt usd

    ReplyDelete
  6. Wow, cool post. I’d like to write like this too – taking time and real hard work to make a great article… but I put things off too much and never seem to get started. Thanks though. Orbit交易所

    ReplyDelete
  7. I have been checking out a few of your stories and i can state pretty good stuff. I will definitely bookmark your blog bitcoin to visa

    ReplyDelete
  8. This comment has been removed by the author.

    ReplyDelete
  9. This comment has been removed by the author.

    ReplyDelete
  10. How is it that simply anybody can write a website and acquire as widespread as this? Its not like youve said something incredibly spectacular –more like youve painted a reasonably picture over a difficulty that you simply recognize nothing concerning I don’t want to sound mean, here. but do you really suppose that you can escape with adding some pretty pictures and not really say anything? Crypto Magazine

    ReplyDelete
  11. Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point. You obviously know what youre talking about, why waste your intelligence on just posting videos to your site when you could be giving us something informative to read? this content

    ReplyDelete

Post a Comment