I have to prompt the user to enter amount in dollars,
then Display a menu so that the user can select among three countries currency (Euro, Real and Pound). I have to use the conversions rates for Euro 0.9, for real 3.2 and U.K. 0.8 The program should look like this:
Enter dollars to convert: 8
Select conversion type:
1 - Dollar to Euro
2 - Dollar to Real(Brazil)
3 - Dollar to Pound (UK)"
? 3
Converted amount: 6.40
I need guidance please to get me on the right track on doing this review for a test later. I am so lost right now This is all I have as of now for my code its not much because I'm lost
if someone tells me what I need to use and how very good that would be so helpful because right now I don't have a clue
#include <iostream>
using namespace std;
int main()
{
int amount;
cout << "Enter dollars to Convert:"<<endl;
cin >> amount;
cout <<" "<<endl;
cout << "Select conversion Type:"<< endl;
cout <<"1 - Dollar to Euro"<<endl;
cout <<"2 - Dollar to Real (Brazil)"<< endl;
cout <<"3 - Dollar to Pound (UK)"<< endl;
if (1==1)
cout <<"?" <<1<<endl;
return 0;
}
can I just use a if For loops , if statements , if-else statements , Boolean not or ? this code program is simple code nothing to complex because I am a beginner
After line 16, you need to do a cin to get the user's choice.
17 18
int choice;
cin >> choice;
Line 18: Comparing 1 with itself will always be true.
What you want is to test the user's choice.
18 19 20
if (choice ==1)
{ // Convert Dollars to Euros
}
Line 8: "amount" is a poor choice for a variable name. Does it refer to dollars or some other currency? You might want to make this value a double. You probably do not want to do integer arithmetic.
PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
Are you asking about the maths? If you were going to do the conversion on paper, how would you do it?
Please note that nobody here is paid to answer your questions. People come in here as and when they have spare time, and as and when they feel like it. Whining because it took more than 5 mins to get an answer to your post is childish, and is not going to make people enthusiastic about helping you.