Thread: Guidance from anyone?

  1. #1

    Guidance from anyone?

    I have tried to write a repetition structure that will prompt the user for a value, read that value into the variable price, increment the variable total by the value entered, and continue repeating the process until total is greater than 10.00 or until the user enters 0 as a value to indicate that they are finished entering values.
    But I did not quite understand the concept of repetition structure, so I did not get anywhere.
    Is anyone willing to guide me in the right direction a little?


  2. #2
    Registered User
    Join Date
    Nov 2002
    probably easiest to use a while loop.

    have a variable for the total, a variable for the value entered.
    check if total is less than or equal to 10 in the condition of the while loop.
    use an if statement after the user inputs the value to see if it is 0. if it is, break out of the loop.

    try coding that, and if you still need help, post what you have tried and we can help you from there.

  3. #3
    Registered User
    Join Date
    Jul 2003
    you need to look into while loops.

    the || operator will come in handy for this as well

  4. #4
    Registered User
    Join Date
    Mar 2002
    [cough] do while [/cough]
    Well, there are a few things wrong with your code:

    1) It does not work.
    2) It does not work.
    3) It does not work.

    Hope this helps.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need some guidance.
    By Kinto in forum C Programming
    Replies: 10
    Last Post: 05-31-2009, 12:02 AM
  2. Guidance, please.
    By mattagrimonti in forum C Programming
    Replies: 2
    Last Post: 11-26-2008, 08:50 AM
  3. need guidance to connect to serial port
    By gnychis in forum Linux Programming
    Replies: 1
    Last Post: 06-02-2005, 10:10 AM
  4. Audio guidance.
    By Sebastiani in forum Windows Programming
    Replies: 6
    Last Post: 12-22-2002, 09:14 AM
  5. advice and possibly guidance
    By nazri81 in forum C++ Programming
    Replies: 3
    Last Post: 11-07-2002, 10:19 PM