I have an exam tomorrow and just going over quizzes I did not do all that good in and was wanting to know if anyone could assist me w\ my mistakes

Quiz 6

This question asks me to put in the output

int Function_one(int y, int x);
int main()
{
int x = 9,
y = 12,
z;
z = Function_One(x,y);
cout << x << " " << y << " " << z << endl;
return 0;
}
int Function_one(omt y, int x)
{
x = 2
return (y/x)
}

The output I put was:

9 12 6

the 6 was wrong and could someone tell me what I did wrong

3
Contributors
3
Replies
4
Views
10 Years
Discussion Span
Last Post by ithelp

I have an exam tomorrow and just going over quizzes I did not do all that good in and was wanting to know if anyone could assist me w\ my mistakes

Quiz 6

This question asks me to put in the output

int Function_one(int y, int x);
int main()
{
int x = 9,
y = 12,
z;
z = Function_One(x,y);
cout << x << " " << y << " " << z << endl;
return 0;
}
int Function_one(omt y, int x)
{
x = 2
return (y/x)
}

The output I put was:

9 12 6

the 6 was wrong and could someone tell me what I did wrong

It's kind of a trick question. look at this (function call):

``z = Function_One(x,y);``

Now look at the function (you have a typo, but i can tell what you meant here):

``int Function_one(omt y, int x)``

Notice that in the call, it's ordered (x, y) and in the function the parameters are this: (y, x). x comes before y in the call, but y comes before x in the function itself. So what is the value of y that is received by the function?

9/2 int returns a 5?

9/2 int returns a 5?

For me it returns 4.

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.