Question about geting my program to work muti part program frist try

Question about puting mutiple programs into one. I am studying C++ for part of my networking course and am not the best at it. This week have to combine smaller programs into one larger one and I am having trouble. I have got this far on my program but for some reason i cant get it to compile and run. The goal is to have it ask for the information in the 2 lower parts then send it back to the main interface. Any ideas or input would be helpful. To some it up its asking for you to enter the number of children Then it gives you a tax rebate of up to 1000 for each child if you have more then 4 children its defualts to 4000.

#include <iostream>

using namespace std;
int getNumChildren( );
int calCredit( );

int main( )
{
int numChildren = 0;
int totCredit = 0;

cout << "Total child tax credit: " << totCredit << endl;

system("pause");
return 0;
}

int getNumChildren( )
{

cout <<"How many children do you have? ";
cin >> numChildren;

return numChildren;
}

int calCredit( )
{

totCredit = numChildren * 1000;
if (totCredit > 4000)
{
totCredit = 4000;
}
return totCredit;
}
calCreadit doesn't know anything about numChildren in main(). You have to pass it as a parameter. See http://www.cplusplus.com/doc/tutorial/functions/
Apart from that, you only have to call these functions from main. You may even write int totalCredit = calCredit( numChildren );
I appreicate that still kinda hard to understand but il try it the example on the website is a bit confusing
Topic archived. No new replies allowed.