Question: 6.54 (Find the Error) Determine whether the following program segments contain errors. For each error, explain how it can be corrected. [Note: For a particular
6.54 (Find the Error) Determine whether the following program segments contain errors. For each error, explain how it can be corrected. [Note: For a particular program segment, its possible that no errors are present in the segment.]
a) template < class A >
int sum( int num1, int num2, int num3 )
{
return num1 + num2 + num3;
}
b) void printResults( int x, int y )
{
cout << The sum is << x + y << ;
return x + y;
}
c) template < A >
A product( A num1, A num2, A num3 )
{
return num1 * num2 * num3;
}
d) double cube( int );
int cube( int );
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
