SocialParasite
100% pure failtanium.
Registered: Jul 2000
Location: Beatrice, Nebraska
Posts: 18490 |
C++ help (again)
Okay, until I get this damn unit finished, I'm gonna be asking for a bit of help. I almost had this damn code up and running, but I kept hitting snags that I can't get myself around. I'm still not a l33t code guy.
quote:
#include <iostream.h>
int main()
{
double weight;
double length;
double width;
double height;
bool heavy, volume;
cout << "--- How big is your package? ---" <<endl;
cout << endl <<endl;
cout << "Enter weight of package in kilograms: ";
cin >> weight;
cout << "Enter length of package in meters: ";
cin >> length;
cout << "Enter width of package in meters: ";
cin >> width;
cout << "Enter height of package in meters: ";
cin >> height;
double vol;
vol = (length*width*height);
if (weight > 27)
heavy = false;
else if (weight <= 27)
heavy = true;
if (vol > .1)
volume = false;
else if (vol <= .1)
volume = true;
{
if (heavy = true && volume = false)
cout << "Package rejected: Too heavy." <<endl;
else if (heavy = false && volume = true)
cout << "Package rejected: Too large." <<endl;
else if (heavy = true && volume = true)
cout << "Package rejected: Too heavy and too large." <<endl;
}
else
cout << "Package accepted." <<endl;
return(0);
}
When I cut and pasted this, it was all indented. I don't know how it will come out here.
I know the error is probably something real simple, but I can't figure it out.
------------------
Have a good day, and if you feel like subjecting your genitals to high doses of x-ray radiation I'm sure the world will kindly thank you.
Report this post to a moderator |
IP: Logged
|