We're learning about functions in Intro to C++ and a problem is telling me my getInput() function is supposed to "get the user's weekly payrate" but at the same time it also says "remember the getInput() and displayInfo() functions are void."
How can I get input if there the function is void?
Also, I am supposed to calculate FICA, and FWT tax's on the weekly pay, how can I do this if the getInput() doesnt return a value?
Someone said I need to use global variables, six hours (not even exaggerating!) and 58745 changes so far and now my program looks like theres no hope. What do I do now?
Error 1 error LNK2019: unresolved external symbol "double __cdecl displayInfo(void)" (?displayInfo@@YANXZ) referenced in function _main main.obj
Error 2 error LNK2019: unresolved external symbol "double __cdecl calcFWT(double)" (?calcFWT@@YANN@Z) referenced in function _main main.obj
Error 3 fatal error LNK1120: 2 unresolved externals C:\Documents and Settings\saaddani\Desktop\Ch10AppE07_DS\Debug\Ch10AppE07_Daniel_Saad.exe
Code:
//Program which caluclates payroll. Page 593, number 7.
#include
#include
using std::cout;
using std::cin;
using std::endl;
using std::fixed;
using std::setprecision;
//function prototype
void getInput(double);
double displayInfo();
double calcFWT(double);
double calcFica(double);
double calcNetPay(double);
//global variables
double weeklySalary = 0.0;
double FWT = 0.0;
double FICA = 0.0;
double NET = 0.0;
int main()
{
getInput(weeklySalary);
calcFWT(FWT);
calcFica(FICA);
calcNetPay(NET);
displayInfo();
return 0;
} //end of main function
//********function definitions*******
void getInput(double weeklySalary)
{
cout << "Please enter your weekly salary: " << endl;
cin >> weeklySalary;
} //end of getInput function
double calcFWT(double FWT, double weeklySalary)
{
return FWT = weeklySalary * 0.2;
} //end of calcFWT function
double calcFica(double FICA)
{
return FICA = weeklySalary * 0.08;
} //end of calcFica function
double calcNetPay(double NET)
{
return NET = weeklySalary - (FWT + FICA);
} //end of calcNetPay function
double displayInfo(double FWT, double FICA)
{
cout << weeklySalary;
cout << FWT << endl;
cout << FICA << endl;
cout << fixed << setprecision(2) << NET;
return 0;
} //end of displayInfo function