Better. He doesn't ask you to input the numbers, but I don't imagine he'll take any points off if you do.
Printable View
Yes.
One thing to be careful about with pow() is that it doesn't have a form which takes pow(int,int). Therefore, at least one of the arguments must be a float or double. In this case, the first argument is a double, so you're fine; for your future reference, however, it might be slightly safer to write "pow(num1,3.0)" rather than "pow(num,3)". This makes the second argument a double as well rather than an int.
Quote:
10. Write a C++ statement that assigns to the answer variable the square root of the following expression: x^2 * y^3. The x,y and answer variable have the double data type.
No, 10 is wrong. it doesn't calculate the required value, it only calculates part of the problem.Quote:
10. answer = pow(x,2) * pow(y,3);
Yeah, I missed that part of it.
No, you're supposed to display the number you just came up with, not a new random number.
That'll work. Don't forget the second part of the problem.
In addition, write a statement that invokes the calcAverage function and assigns its return value to a double variable named quotient. Use the following numbers as the actual arguments: 45.67, 8.35, 125.78, 99.56.