Help please

This is a discussion on Help please within the C++ Programming forums, part of the General Programming Boards category; I am a beginning at C+ programming and desperately need help on a couple things. Any help is appreciated. 1. ...

  1. #1
    Registered User
    Join Date
    Jul 2003
    Posts
    3

    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

  2. #2
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    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...
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  3. #3
    Registered User
    Join Date
    Jul 2003
    Posts
    3
    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;
    }

  4. #4
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    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.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  5. #5
    Registered User
    Join Date
    Oct 2002
    Posts
    291
    use code tags

    What error message do you get ?

  6. #6
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  7. #7
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    just picking on things:
    int main() {...}

    I dont' see anything wrong with the code... I didn't compile it tho...
    Last edited by major_small; 07-29-2003 at 08:24 PM.
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  8. #8
    Registered User
    Join Date
    Jul 2003
    Posts
    3
    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

  9. #9
    Registered User KurtSurge's Avatar
    Join Date
    Aug 2003
    Posts
    25
    Am i the only one who notices what Hammer and Salem are saying?
    It's too bad that stupidity isn't painful
    --Anton Szandor LaVey

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21