Hello,

I have to make this programe. Please I need some tips and help to accomplish my objective. Please give a sample sketch. Must guide me....


Problem Statement: Exchange of currency rates

You are required to write a program for Currency Exchange rates. User will have three options i.e. Pakistani Rupees, US Dollars, and Euro.


Detailed Description:

1. The program should display

Please select currencies that you want to exchange.
Description:
Enter ‘R’ for Pakistani Rupees.
Enter ‘E’ for Euro.
Enter ‘D’ for Dollar.

Then your program should take these inputs,

2. Depending upon the choices that user has entered, your program will further display the prompt

3. Then the program should take two inputs from the user as:
-----------------------------------------------------------------
Please select the currency that you want to convert :
Please select the currency that you want to convert into:
-----------------------------------------------------------------

4. After getting both inputs, program will calculate the currency rates on the basis on this information.


1 Euro = 112 Rupees.
1 Dollar = 84 Rupees.
1 Euro = 1.33 Dollars
1 Dollar = 0.75 EUR


After calculating the conversion rate for the selected currencies display it on the screen.

In the end of the program, user should be asked if he/she wants to make another conversion.

If user presses y then the whole program should start again. If user presses n then the program should terminate.


Sample Output


Dev c++ Output:
Please select currencies that you want to exchange.
Description:
Enter ‘R’ for Pakistani Rupees.
Enter ‘E’ for Euro.
Enter ‘D’ for Dollar.

Please select the currency that you want to convert : E
Please select the currency that you want to convert into: D

Please enter the amount in Euro : 12

12 Euro = 16 Dollars

Do you want to make another conversion? (y/n) : y

Please select currencies that you want to exchange.
Description:
Enter ‘R’ for Pakistani Rupees.
Enter ‘E’ for Euro.
Enter ‘D’ for Dollar.

Please select the currency that you want to convert : R
Please select the currency that you want to convert into: D

Please enter the amount in Rupees : 90

90 Rupees = 1.07143 Dollars

Do you want to make another conversion? (y/n) : n

I Have to use if/else and while loop in this programe.

Comments
Show effort first.

You should ist try by yourself compile your code n then post your errors and full code so that we can provide you guidance

i have made the sketch of this programe. Now please gudie and provide some help plz......................

#include <iostream.h>


main()
{

           char convert;
           char coninto;
           float amount=0;
           char choice;
           float e=0, r=0, d=0;






        cout<<"   Please select currencies that you want to exchange."<<endl;
        cout<<"   Description:"<<endl;
        cout<<"        Enter 'R' for Pakistani Rupees."<<endl;
        cout<<"        Enter 'E' for Euro."<<endl;
        cout<<"        Enter 'D' for Dollar."<<endl;

        cout<<"  -----------------------------------------------------------------"<<endl;
          cout<<"\nPlease select the currency that you want to convert :";
          cin>>convert;
          cout<<"\nPlease select the currency that you want to convert into:";
          cin>>coninto;
        cout<<"  -----------------------------------------------------------------"<<endl;







              if (convert == 'E' || 'e')
              {
                  cout<<"Please enter the amount in Euro : ";
                  cin>>amount;

                  if (convert == 'R' || 'r')

                  cout<<"Please enter the amount in Rupee : ";
                  cin>>amount;
              }
              }

Edited 6 Years Ago by __avd: Added [code] tags. For easy readability, always wrap programming code within posts in [code] (code blocks).

you are not using if statements in proper way.i mean their brackets {} are not properly in place e.g

if
{
/// do stufff here
}
else if 
{
/// do stuff here
}
else
{
/// do stuff here
}

so in your code

//1euro=1.34dollars conversion
if (convert == 'E' || 'e')
              {
                  cout<<"Please enter the amount in Euro : ";
                  cin>>amount;
                  e=1.34 * amount;
                  cout<<amount<<"Euros<<"="<<e<<endl;
}

Get input for dollar the same way and calculate ist everything n then compile how it goes once you finish we wil move to next part

Edited 6 Years Ago by Nick Evan: Added code-tags

i have written this code but it isnt working properly...... plz check it

#include <iostream.h>

main()
{
        char con=0;
        char conin=0;
        float er=112, dr=84, ed=1.33, de=0.75;
        float euro=0, rupee=0, dollar=0;
        float amount=0;
        float cond=0;





        cout<<"   Please select currencies that you want to exchange."<<endl;
cout<<"Description:"<<endl;
        cout<<"Enter 'R' for Pakistani Rupees."<<endl;
        cout<<"Enter 'E' for Euro."<<endl;
        cout<<"Enter 'D' for Dollar."<<endl;

        cout<<"-----------------------------------------------------------------"<<endl;
          cout<<"Please select the currency that you want to convert :";
          cin>>con;
          cout<<"Please select the currency that you want to convert into:";
          cin>>conin;
        cout<<"-----------------------------------------------------------------"<<endl;


         if      ((con == 'E' || 'e') && (conin == 'D' || 'd'))
              {
                  cout<<"Please enter the amount in Euro : ";
                  cin>>amount;
                  cond= ed * amount;
                  cout<<amount<<" Euros "<<" = "<<cond<<endl;
              }

         else if ((con == 'E' || 'e') && (conin == 'R' || 'r'))
              {
                  cout<<"Please enter the amount in Euro : ";
                  cin>>amount;
                  cond= er / amount;
                  cout<<amount<<" Euros "<<" = "<<cond<<endl;
              }
         else if ((con == 'D' || 'd') && (conin == 'R' || 'r'))
              {
                  cout<<"Please enter the amount in Dollar : ";
                  cin>>amount;
                  cond= dr / amount;
                  cout<<amount<<" Dollars "<<" = "<<cond<<endl;
              }
         else if ((con == 'D' || 'd') && (conin == 'E' || 'e'))
              {
                  cout<<"Please enter the amount in Dollar : ";
                  cin>>amount;
                  cond= de * amount;
                  cout<<amount<<" Dollars "<<" = "<<cond<<endl;
              }
         else if ((con == 'R' || 'r') && (conin == 'D' || 'd'))
              {
                  cout<<"Please enter the amount in Rupee : ";
                  cin>>amount;
                  cond= de * amount;
                  cout<<amount<<" Rupees "<<" = "<<cond<<endl;
              }


}

Edited 6 Years Ago by WaltP: Added CODE Tags again

i have written this code but it isnt working properly...... plz check it

Check it for what? Are we looking for something? I don't understand whay you need us to 'check it' for.

if you will not check it than how will you help me in some errors inside the program? I have wored it hardly and you are not going to help me? :-(

I am very disappointed with your answer. Thanks..... :-(
I will never ask daniweb for help and i will never post on it again.....

Good Bye... :-(

Comments
good riddance

I am very disappointed with your answer. Thanks..... :-(
I will never ask daniweb for help and i will never post on it again.....

Good Bye... :-(

don't let the door hit you in the back.
You won't be missed.

This article has been dead for over six months. Start a new discussion instead.