Sunday, December 7, 2014

write a program calculate square and cube of given number using inline function

#include
#include
class line
{
public:
inline float multi(float a,float b)
{
return(a*b);
}
inline float cube(float a)
{
return(a*a*a);
}
};
void main()
{
line obj;
float a1,b1;
clrscr();
cout<<"\n Enter Two Value ";
cin>>a1>>b1;
cout<<" Multiplication is :"<<obj.multi(a1,b1)<<endl;
cout<<" Cube of val1 is :"<<obj.cube(a1)<<endl;
cout<<" Cube of val2 is :"<<obj.cube(b1)<<endl;
getch();
}

No comments:

Post a Comment