473,320 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

a c++ program to convert currencies

1
how to create a c++ program to convert currencies
Nov 23 '17 #1
3 4271
weaknessforcats
9,208 Expert Mod 8TB
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
donbock
2,426 Expert 2GB
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
#include <iostream>
using namespace std;
void main()
{
float P,R;
cout<<"Enter the PKR amount=";
cin>>P;
R=P/28.25;
cout<<"Saudi Riyal:"<<R<<endl;
system("pause");
}
here is a code
Nov 28 '17 #4

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

Similar topics

2
by: techy techno | last post by:
hii Experts..!! I need someone to tell me where I can get a Currency Converter like http://cconv.textor.com please can someone tell me where I can get it I need it for free + I dont need...
4
by: D Newsham | last post by:
Hi, This javascript creates a table that has a header and side column that do not move while scrolling through the table. I need to convert this to vb script. Can anybody help, or do you have...
8
by: drose0927 | last post by:
Please help! I can't get my program to exit if the user hits the Escape button: When I tried exit(EXIT_SUCCESS), it wouldn't compile and gave me this error: Parse Error, expecting `'}''...
3
by: Burdzy | last post by:
Hi, I am working on writing a .zip file class based on the PKWare Specifications, and in the .zip format, they save the modified time of the file in 2 pieces: 1. 2 bytes for the time 2. 2 bytes for...
3
by: Concem01 | last post by:
Hello, I am a student a UMUC online and am currently taking C programming. I have never done any programming at all and was wondering if someon can help me with my class assignment. the...
334
by: Antoninus Twink | last post by:
The function below is from Richard HeathField's fgetline program. For some reason, it makes three passes through the string (a strlen(), a strcpy() then another pass to change dots) when two would...
1
by: =?Utf-8?B?Y2Fyb2xl?= | last post by:
we have petty cash in different currencies... we used petty cash before with 3 currencies with QB - someone an idea how we could use it in the business accounting (we use microsoft accounting pro...
2
by: (PeteCresswell) | last post by:
I'm thinking ISO 4217 as shown on http://www.xe.com/iso4217.php Bond trading system. Users are definitely OK with all of a given security's trades being restricted to a single currency. ...
5
by: mostafalabib | last post by:
i want program convert hexadecimal file to c language
3
by: Daniel DePasqua | last post by:
I do not understand the concept of inputing a number and having the program convert it to an integer, float and string. How would you write a program that does that
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.