-
Help please
I am a beginning at C+ programming and desperately need help on a couple things. Any help is appreciated.
1. Write a program that allows a user to enter the length, width and depth of their swimming pool ( assume pool does not have deep or shallow end) Calculate the volume of the pool and display a message to the user w/the result.
2. Write a program that allows a user to enter a number of cents. Determine how many dollars the cents make up and print the number of dollars and remaining cents to the screen.
thanks in advance any help.
Brandi
-
1. Write a program that allows a user to enter the length, width and depth of their swimming pool ( assume pool does not have deep or shallow end) Calculate the volume of the pool and display a message to the user w/the result.
you'll need:
1 header file (see 'hello world' programs)
1 function (see 'hello world' programs)
'cin' and 'cout' statements (see 'hello world' programs)
3 variables (maybe four)
2. Write a program that allows a user to enter a number of cents. Determine how many dollars the cents make up and print the number of dollars and remaining cents to the screen.
you'll need:
1 header file (see 'hello world' programs)
1 function (see 'hello world' programs)
'cin' and 'cout' statements (see 'hello world' programs)
1 variable (float, maybe two)
if you need more help than that, then you probably shouldn't even try to learn C++... it's going to take work...
-
Ok, I have tried this several times and still it comes out as a failed solution. Here is what I did. If you can just help me figure out what is wrong with it. Thanks
#include <iostream>
using namespace std;
void main () {
int iLength, iWidth, iDepth, iVolume;
cout << "Enter your pool's length (in feet): ";
cin >> iLength;
cout << "Enter your pool's width (in feet): ";
cin >> iWidth;
cout << "Enter your pool's depth (in feet): ";
cin >> iDepth;
iVolume = iLength * iWidth * iDepth;
cout << "The volume of your pool is " << iVolume
<< " cubic feet." << endl;
}
-
Code tags please
void main(void)
>>and still it comes out as a failed solution<<
What does that mean? What fails exactly?
Code:
Enter your pool's length (in feet): 10
Enter your pool's width (in feet): 5
Enter your pool's depth (in feet): 2
The volume of your pool is 100 cubic feet.
-
use code tags
What error message do you get ?
-
-
just picking on things:
int main() {...}
I dont' see anything wrong with the code... I didn't compile it tho...
-
I finally figured out the problem on the first one. It was a minor error I overlooked. I still cannot figure out how to create the second program though, the centstodollars. I dont know what to use to get it to convert what you enter in cents to dollars. If anyone can help with that part I would appreciate it. thanks
-
Am i the only one who notices what Hammer and Salem are saying? :(