PDA

View Full Version : Need some help


jeffshaffer
01-19-2007, 02:58 PM
I have two problems one is this code
//Enter input data
cout << "Please Enter Length of Pool: ";
cin >> length;
cout << "Please Enter Width of Pool: ";
cin >> width;
cout << "Please Enter Depth of Pool: ";
cin >> depth;

//Calculate the cubic feet of water in swimming pool
water = length * width * depth

//Display the results of calculation,
cout << "A swimming pool with a length of " << length " a width of " << width " and a depth of " << depth " will contain " << water " cubic feet of water" << endl;

and my other problem is: I need to write a program that displays a number, its square, and its cube from 5 to 20. NOT sure how to begin to write that, Im not supposed to use alot of cout statements either im supposed to use a looop i beleive.

rpgfan3233
01-19-2007, 07:06 PM
I found a problem with the code you posted. You forgot to end the statement that calculates the number of cubic feet of water in a swimming pool.

As for you other problem, do you have any code yet? If so, please post it. Your thinking was right when you mentioned a loop.

oracleguy
01-19-2007, 09:17 PM
You have an error on this line:
cout << "A swimming pool with a length of " << length << " a width of " << width << " and a depth of " << depth << " will contain " << water << " cubic feet of water" << endl;

You forgot a few operators in there. The red text is what I added.