Access over 20 million homework & study documents

search

6 47 (Find the Error) Find the error in each of the following progra

Content type
User Generated
Rating
Showing Page:
1/2
6.47 (Find the Error) Find the error in each of the following
program segments and explain how to correct it: (C++)
a)
float cube( float ); // function prototype
cube( float number ) // function definition
{
return number * number * number;
}
b)
int randomNumber = srand();
c)
float y = 123.45678;
int x;
x = y;
cout << static_cast < float >( x ) << endl;
d)
double square( double number )
{
double number = 0;
return number * number;
}
e)
int sum( int n )
{
if ( 0 == n )
return 0;
else
return n + sum( n );
}

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/2

Sign up to view the full document!

lock_open Sign Up
Unformatted Attachment Preview
6.47 (Find the Error) Find the error in each of the following program segments and explain how to correct it: (C++) a) float cube( float ); // function prototype cube( float number ) // function definition { return number * number * number; } b) int randomNumber = srand(); c) float y = 123.45678; int x; x = y; cout ( x ) ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Anonymous
Great! Studypool always delivers quality work.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4