Answer to Question #191919 in C++ for Kaviyan P

Question #191919

Construct a C++ program to find the square of a number using default arguments and inline functions


1
Expert's answer
2021-05-11T23:51:58-0400
#include<iostream.h>
#include<conio.h>
class power
{
public:
inline int square(int n)
{
return n*n;
}
};
void main()
{
int n,r;
power p;
clrscr();
cout<<“\nEnter the Number: \n” ;
cin>>n;
r=p.square(n);
cout<<“\nSquare of “<<n<<” = “<<r<<endl;
getch();
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment