Hello just finished re- reading chapter 3...about functions... I learnt more of this from reading it when i was at home than when im at uni! Amazing!!
However I get a compile error saying
'not all control paths return a value'
heres the code:
#include <iostream>
using namespace std;
int test(int);
int ha(int);
int main()
{
int y;
cin >> y;
cout << "This is now going through the functions \n\n\n" << test(y);
return 0;
}
int test (int x)
{
int a;
int b;
cout << "please enter a";
cin >> a;
cin >> b;
if (a == 1)
{
cout << "now returning a";
return a;
}
else if ( a < 4)
{
cout << "function call to b" << ha(b);
}
}
int ha(int c)
{
return c*c;
}
ok it doesnt make much sence but it was mocked up with what i learnt from the text book ... Please don't give me the answer hints would be most appricated ... :D