C++/Employee Payroll program
1. Visual C++ 6.0
2. input data from keyboard, calculate gross and net pay, print to screen and file.
3. using classes employee.h and payroll.h
4. I am an idiot! (just kidding) I dont know how to pass the info from one function to the next. I get errors like "C2660: 'PrintStubToScreen' : function does not take 0 parameters"
Passing info from one function to another function can be tricky. You could try using global variables, although this method is usually frowned upon. It really depends on where the functions are being called. If you have function 'A' and function 'B', both using the same variables, and being called from the 'main' portion of your program then the solution is relatively simple. Instead of doing a call by value, do a call by reference for any variables that you send to the function. That way the value of the variables that get modified in function 'A' will stay modified when the function is complete. Then when function 'B' is called, the variables that it uses will have the appropriate values.
However, if you have to call function 'B' from within function 'A', and 'B' requires variables that 'A' doesn't use, then it gets to be a bit more tricky. If function 'A' needs variables 1, 2, and 3, but function 'B' needs variables 3, 4, and 5, then you need to send the values of all the variables (1, 2, 3, 4, 5) to function 'A'. If you don't want to pass any values onto a function, then just don't give it any input parameters (occasionally I've done this). Doing this would solve the problem of "C2660: 'PrintStubToScreen' : function does not take 0 parameters". I hope this helps. If you need any clarification please let me know.
Best Of Luck,