help needed in a simple prob!

This is a discussion on help needed in a simple prob! within the C++ Programming forums, part of the General Programming Boards category; Hello friends,I am new to this board and not an experience programmer.I am still learning c++. I need ur help ...

  1. #1
    o0o
    o0o is offline
    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.
    Attached Files Attached Files
    • File Type: cpp 13.cpp (935 Bytes, 98 views)

  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
    o0o
    o0o is offline
    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
    32,833
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  5. #5
    o0o
    o0o is offline
    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, 03:44 PM
  3. Simple Dialog Box Prob (resource)
    By C+noob in forum Windows Programming
    Replies: 1
    Last Post: 07-15-2005, 03: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, 04:00 PM

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