Construct a C++ program to find the square of a number using default arguments and inline functions
#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;
}
Comments
Leave a comment