This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
1
Make cout display numbers with decimal points.
Post Flair (click to view more posts with a particular flair)
Post Body
I'm working on a program that converts US Dollars to Euros, but it doesn't work well because it won't display any place values past the whole number. So it says 1USD = 1 Euro, which is not accurate, and so on. I need it to display to the 100ths place in order for it to be effective.
#include <iostream>
using namespace std;
int main()
{
int z, USD, b, Euro, d;
cout << "USD-Euro Converter v1.0.\n";
cout << "Choose what you want to convert:\n";
cout << "1: United States Dollars -> Euro\n";
cout << "2: Euro -> United States Dollar\n";
cin >> z;
//If Z is neither 1 or 2, the program will continue to Euro -> USD
if (z == 1)
{
cout << "Input USD Amount:\n";
cin >> USD;
b = USD * 0.89000;
cout << USD << " US Dollars are worth " << b << " euros.\n";
cout << "Dislcaimer: Values are subject to change day to day.\n";
return 0;
}
else
{
cout << "Input Euro Amount:\n";
cin >> Euro;
d = Euro * 1.12000;
cout << Euro << " euros are worth " << d << " US Dollars.\n";
cout << "Dislcaimer: Values are subject to change day to day.\n";
return 0;
}
}
Author
Account Strength
100%
Account Age
10 years
Verified Email
Yes
Verified Flair
No
Total Karma
45,296
Link Karma
5,940
Comment Karma
39,331
Profile updated: 5 days ago
Posts updated: 4 months ago
Subreddit
Post Details
We try to extract some basic information from the post title. This is not
always successful or accurate, please use your best judgement and compare
these values to the post title and body for confirmation.
- Posted
- 9 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/cpp_questio...