#include<iostream>
#include<conio.h>
using namespace std;
/*
class name
{
public:
test()
{
int a;
cout<<" enter the nomber";
cin>> a;
}
void funct()
{
cout<<"Enetr nomber is :";
}
};
int main()
{
name n;
n.funct();
getch();
return 0;
}*/
class math
{
int num;
public:
math()
{
}
math(int n)
{
num = n;
}
void showsq()
{
cout<<"\nsquare of "<<num<<"is ="<<(num*num);
}
void showcube()
{
cout<<"\ncube of "<<num<<"is ="<<(num*num*num);
}
};
int main()
{
math m1=math (2);
math m2(3);
m1.showsq();
m1.showcube();
m2.showsq();
m2.showcube();
return 0;
}
No comments:
Post a Comment