Thread: Passing a variable in void to another void function

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Mar 2006
    Posts
    36

    Passing a variable in void to another void function

    Ok, so in my first void, the user inputs 4 numbers via a looping statement. In the next void statement, it is supposed to add these four numbers up and print them on screen. We are currently on structures/classes but I'm not sure how to print the summed up number in another void statement.
    Code:
    void Salesperson :: getsales ()
    {
       double revenue; 
    
       for ( int i = 1; i <= 4; i++ ) 
       {
          cout << "Enter sales for quarter " << i << ": ";
          cin >> revenue;
          setsales( i, revenue);
    
       } // end for
    
    }
    As you can see, here is were the user inputs the four numbers. I am not sure if the numbers are added here as well or if they are added in the next void statement.
    Last edited by stevedawg85; 05-05-2006 at 04:48 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 48
    Last Post: 09-26-2008, 03:45 AM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. Replies: 5
    Last Post: 02-08-2003, 07:42 PM
  4. qt help
    By Unregistered in forum Linux Programming
    Replies: 1
    Last Post: 04-20-2002, 09:51 AM
  5. Just one Question?
    By Irish-Slasher in forum C++ Programming
    Replies: 6
    Last Post: 02-12-2002, 10:19 AM