Getting a Bougus number.....

This is a discussion on Getting a Bougus number..... within the C++ Programming forums, part of the General Programming Boards category; Code: int Machines::Set_Income() { int NumberofDays, cash_made,daily_average; cout <<"How much money did the machine make in one day?" <<endl; cin ...

  1. #1
    1479
    Join Date
    Aug 2003
    Posts
    253

    Question Getting a Bougus number.....

    Code:
    int Machines::Set_Income()
    {
        int NumberofDays, cash_made,daily_average;
    
               cout <<"How much money did the machine make in one day?" <<endl;
               cin >>cash_made;
               cout <<"How many days would you like to calculate?" <<endl;
               cin >>NumberofDays;
               daily_average = cash_made * NumberofDays;//-UpkeepCost;
               cout <<"In " <<NumberofDays <<" days the machine made: " <<daily_average;
               
    }
    I am getting a bogus number when this member function is calculated. Any ideas??
    Knowledge is power and I want it all

    -0RealityFusion0-

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    You never return anything from the function. Also is cash supposed to be an int or a float?
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  3. #3
    1479
    Join Date
    Aug 2003
    Posts
    253
    I figured it out. Thanks Wizard!
    Knowledge is power and I want it all

    -0RealityFusion0-

  4. #4
    Registered User
    Join Date
    Jan 2003
    Posts
    25
    ok im thinking that he is missing the "return 0;" code


    how come i do not see the header files? is it because he didnt add it for us to see? or.....

  5. #5
    Registered User
    Join Date
    May 2003
    Posts
    43
    Because most people only post the code they're having trouble with, not the entire thing.
    Programmer's Law:

    If your program doesn't work, look for the part that you didn't think was
    important.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help getting program print out the digit in words
    By cosmiccomputing in forum C Programming
    Replies: 26
    Last Post: 04-24-2008, 09:28 AM
  2. Need help with this compiler error
    By Evangeline in forum C Programming
    Replies: 7
    Last Post: 04-05-2008, 10:27 AM
  3. Prime number program problem
    By Guti14 in forum C Programming
    Replies: 11
    Last Post: 08-06-2004, 05:25 AM
  4. parsing a number
    By juancardenas in forum C Programming
    Replies: 1
    Last Post: 02-19-2003, 01:10 PM
  5. Random Number problem in number guessing game...
    By -leech- in forum Windows Programming
    Replies: 8
    Last Post: 01-15-2002, 05:00 PM

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