C++ Program to Demonstrate inline Function
Code:
Sample Output:
Comment bellow for your Query and Feedback
Code:
/*C++ Program to Demonstrate inline Function*/
#include<iostream.h>
#include<conio.h>
class line
{
public:
inline float multi(int x, int y)
{ return (x*y);
}
inline float cube(int z)
{ return (z*z*z);
}
};
void main()
{
clrscr();
line obj;
int val1,val2;
cout<< "\n Enter 2 Numbers\n";
cin>> val1 >> val2;
cout<< " Multiplication is " <<obj.multi(val1,val2)<<endl;
cout<< " Cube is "<<obj.cube(val1)<<endl;
getch();
}
#include<iostream.h>
#include<conio.h>
class line
{
public:
inline float multi(int x, int y)
{ return (x*y);
}
inline float cube(int z)
{ return (z*z*z);
}
};
void main()
{
clrscr();
line obj;
int val1,val2;
cout<< "\n Enter 2 Numbers\n";
cin>> val1 >> val2;
cout<< " Multiplication is " <<obj.multi(val1,val2)<<endl;
cout<< " Cube is "<<obj.cube(val1)<<endl;
getch();
}
Sample Output:
Comment bellow for your Query and Feedback
0 comments:
Confused? Feel free to ask
Post a Comment