- Apr 21, 2004
- 471
- 0
- 0
my desired output shoud be 185.73, but the program will end up with 187.728. any ideas on why its showing 3 decimal places?
#include <iostream>
using namespace std;
int main()
{
int Length;
int thickness;
int Width;
double cost;
cout <<"What is the length?" << endl;
cin >> Length;
cout <<"What is the thickness?" << endl;
cin >> thickness;
cout <<"What is the width?" << endl;
cin >> Width;
double bfeet = (Length*thickness*Width)/1728.00;
cout <<"What is the cost of the wood per board foot?" << endl;
cin >> cost;
double total = cost * bfeet;
cout <<"The lumber costs:" << total << endl;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int Length;
int thickness;
int Width;
double cost;
cout <<"What is the length?" << endl;
cin >> Length;
cout <<"What is the thickness?" << endl;
cin >> thickness;
cout <<"What is the width?" << endl;
cin >> Width;
double bfeet = (Length*thickness*Width)/1728.00;
cout <<"What is the cost of the wood per board foot?" << endl;
cin >> cost;
double total = cost * bfeet;
cout <<"The lumber costs:" << total << endl;
return 0;
}
