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


//Program which caluclates payroll. Page 593, number 7. 


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() 


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
9 Years
Discussion Span
Last Post by Ancient Dragon

Look at the function prototypes on lines 13-17 then look at the actual functions. The function arguments must be identical in each case. For example displayInfo() on line 14 does not have any parameters, yet on 59 it does -- in c++ they are not the same functions.

>>but at the same time it also says "remember the getInput() and displayInfo() functions are void."
I think he means that they do not return a value, that doesn't say anything about the functions not having parameters. So line 14 should be: void displayInfo(double FWT, double FICA); >>Someone said I need to use global variables
Don't believe him (or her). Globals are discouraged and rarely needed. Pass values as parameters into the functions.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.