Don\'t know how to write this program. This is a first year C++ Class. Heres the
ID: 3621638 • Letter: D
Question
Don't know how to write this program. This is a first year C++ Class.Heres the instructions:
1. Write program with an overloaded function named CUBED()
2. If the parameter passed is a boolean then it should return a value of 1 of true and 0 if false.
3. If the parameter passed is a floating point then a floating point value is returned that is the value "cubed" or raised to the 3rd power.
4. If the parameter passed is an integer then a floating point value is returned that is the value "cubed" or raised to the 3rd power.
5. Demonstrate all of these being called from the main function.
Pls post full code below. Thanks
Explanation / Answer
please rate - thanks
#include <iostream>
using namespace std;
int cubed(bool);
double cubed(double);
int cubed(int);
int main()
{cout<<cubed(true)<<endl;
cout<<cubed(3)<<endl;
cout<<cubed(2.2)<<endl;
system("pause");
return 0;
}
int cubed(bool a)
{if(a==true)
return 1;
return 0;
}
double cubed(double a)
{return a*a*a;
}
int cubed(int a)
{return a*a*a;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.