help with functions and void?

I am a newbie at this and I am confused on how to go on to solve these two questions. Any help and walkthroughs in explaining on how to do this will be nice.

What is the output of the following code snippet if Question6_() is called by main.

int six_(int i, int j=4)
{
return i+j+1;
}
void Question6_()
{
cout << six_(3,six_(5)) << endl;
}


What is the output of the following code? (Hint: the code will not error and do pay attention to where the “endl”s are)

short function2(int i)
{
return i / 2;
}
int function(int i)
{
i = i * 3;
return i - 1;
}
int main()
{
int number = 7;
int left = function(number);
cout << number;
cout << function2(left) << endl;

system("Pause");
return 0;
}
Start with something simpler. What is the output here?
1
2
3
4
5
6
7
8
9
int six_(int i, int j=4)
{
  return i+j+1;
}

int main()
{
  cout << six_(5) << endl;
}


How about here:
1
2
3
4
5
6
7
8
9
10
11
int function(int i)
{
  i = i * 3;
  return i - 1;
}

int main()
{
  int number = 7;
  cout << function(number) << endl;
}
Topic archived. No new replies allowed.