Thread: help needed in a simple prob!

  1. #1
    Registered User o0o's Avatar
    Join Date
    Dec 2003
    Posts
    37

    Unhappy help needed in a simple prob!

    Hello friends,I am new to this board and not an experience programmer.I am still learning c++.

    I need ur help with this simple code.

    The output should be as follows

    Enter the gallons used(-1 to end input): some value
    Enter the miles driven: some value
    The miles/gallon for this tank was: some value

    repeat this
    .
    .
    .
    .
    .
    .
    .
    till user enters -1 for gallons

    then calculate the total average of all entered data

    The total average comes out: some value

    hope u get that.If u do ,plz help me asap but remember u can only use

    if,if/else,while,do/while,switch and for structures/statements.

    I have attached my code so that u can check it and correct it.

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    Do you have a specific problem we can help you with?
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    Registered User o0o's Avatar
    Join Date
    Dec 2003
    Posts
    37

    yes the prob is in the attachment.

    See the attachment

    it just doesn't make sense.can u check it.anyways thanku 4 consideration.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Seemed OK to me
    All it really needs is an if() to stop it asking for miles, when you enter -1 for gallons.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User o0o's Avatar
    Join Date
    Dec 2003
    Posts
    37

    thanku salem!

    thanku v m.It helped.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Simple Socialising Chat Bots
    By bengreenwood in forum C++ Programming
    Replies: 10
    Last Post: 11-28-2007, 08:42 AM
  2. simple 2d "putpixel" api for windows?
    By spiky in forum C Programming
    Replies: 2
    Last Post: 10-27-2005, 02:44 PM
  3. Simple Dialog Box Prob (resource)
    By C+noob in forum Windows Programming
    Replies: 1
    Last Post: 07-15-2005, 02:27 AM
  4. Help needed with a simple programm!!
    By jabrouni1 in forum C Programming
    Replies: 16
    Last Post: 11-21-2004, 09:07 PM
  5. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM