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

Recommended Answers

All 3 Replies

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.