Answer to Question #191850 in C++ for Ajith M

Question #191850

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


1
Expert's answer
2021-05-12T02:14:35-0400
#include<iostream>
#include<conio.h>
using namespace std;
class power
{


public:


inline int square(int n)


{


return n*n;


}


};


int main()


{


int n,r;


power p;


cout<<"\nEnter the Number: \n" ;


cin>>n;


r=p.square(n);


cout<<"\nSquare of "<<n<<" = "<<r<<endl;


}

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