Type in the following main routine exactly as shown and add the definitions of two functions, cubeit0 and cubeit1, each
Posted: Mon May 09, 2022 7:04 am
Type in the following main routine exactly as shown and add the
definitions of two
functions, cubeit0 and cubeit1, each that provides the cube of the
argument x. You
may not use the pow() math library function.
#include <iostream>
//Function cubeit0 goes here
//Function cubeit1 goes here
int main(void)
{ cout << "Input a number to be cubed: ";
double x;
cin >> x;
cout << cubeit0(x) << endl;
double result;
cubeit1(x,result);
cout << result << endl;
return 0;
}
Here is an example of how the program is intended to work:
% a.out
Input a number to be cubed: 3
27
27
%
definitions of two
functions, cubeit0 and cubeit1, each that provides the cube of the
argument x. You
may not use the pow() math library function.
#include <iostream>
//Function cubeit0 goes here
//Function cubeit1 goes here
int main(void)
{ cout << "Input a number to be cubed: ";
double x;
cin >> x;
cout << cubeit0(x) << endl;
double result;
cubeit1(x,result);
cout << result << endl;
return 0;
}
Here is an example of how the program is intended to work:
% a.out
Input a number to be cubed: 3
27
27
%