By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,548 Members | 1,183 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,548 IT Pros & Developers. It's quick & easy.

a c++ program to convert currencies

P: 1
how to create a c++ program to convert currencies
Nov 23 '17 #1
Share this Question
Share on Google+
3 Replies

Expert Mod 5K+
P: 9,197
For get the program for a minute. Start by writing a function to convert, say, US dollars to Canadian dollars.

When the function works, just call it to convert US currency to Canadian currency.

Then write a second function that does the reverse. It converts Canadian dollars to US dollars.

Now you can write a simple program to convert to/from US and Canada.

Just keep writing functions for the currencies you are interested in.

You have to get a small program working or there is no hope of getting a complex one working.

There is a principle in software development that says that every complex program that works is derived from a previous version of the program that also worked. Stated the other way, every effort to write a complex program from scratch has failed.

Post again and let me know how this is going.
Nov 26 '17 #2

Expert 100+
P: 2,404
The simplest model is to assume the same exchange rate for both buying and selling each currency; and that exchanging through an intermediate currency nets the same result as a direct exchange. That is,
  • You get back exactly your initial investment if you convert from currency A to currency B and then back to A again.
  • You get the same result exchanging currency A to B to C as you do by exchanging A to C.
Real-world foreign exchange markets are not so simple. There are separate buy/sell exchange rates for every pair of currencies.

Can you make the simplifying assumptions listed above or does your program need to accommodate the messier real world?
Nov 27 '17 #3

P: 3
#include <iostream>
using namespace std;
void main()
float P,R;
cout<<"Enter the PKR amount=";
cout<<"Saudi Riyal:"<<R<<endl;
here is a code
Nov 28 '17 #4

Post your reply

Sign in to post your reply or Sign up for a free account.