## C++ program using class to calculate square and cube of given number using inline function .

Sample Syntax:

#include<iostream.h>
class power
{
public:
inline int square(int n)
{
-----------------------------
-----------------------------
}
inline int cube(int n)
{
-----------------------------
-----------------------------
}

};
void main()
{
-------------------------------
-------------------------------
}

1. Nazmul Alam
id : 201420674

Write a C++ program using class to calculate square and cube of given number using inline function :

‪#‎include‬
class power
{
public:
inline int square(int n)
{
return n*n;
}
inline int cube(int n)
{
return n*n*n;
}
};
void main()
{
int n,r;
power p;
clrscr();
cout<<“\nEnter the Number: \n” ;
cin>>n;
r=p.square(n);
cout<<“\nSquare of “<<n<<” = “<<r<<endl;
r=p.cube(n);
cout<<“\nCube of “<<n<<” = “<<r<<endl;
getch();
}

2. Khandoker Mehedi Hasan
Id : 201421043

Write a C++ program using class to calculate square and cube of given number using inline function :

#include
class power
{
public:
inline int square(int n)
{
return n*n;
}
inline int cube(int n)
{
return n*n*n;
}
};
void main()
{
int n,r;
power p;
clrscr();
cout<<“\nEnter the Number: \n” ;
cin>>n;
r=p.square(n);
cout<<“\nSquare of “<<n<<” = “<<r<<endl;
r=p.cube(n);
cout<<“\nCube of “<<n<<” = “<<r<<endl;
getch();
}

3. priyo nath chakma
ID-201420406

#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();
}

4. ID-201420405

‪#‎include‬
class power
{
public:
inline int square(int n)
{
return n*n;
}
inline int cube(int n)
{
return n*n*n;
}
};
void main()
{
int n,r;
power p;
clrscr();
cout<<“\nEnter the Number: \n” ;
cin>>n;
r=p.square(n);
cout<<“\nSquare of “<<n<<” = “<<r<<endl;
r=p.cube(n);
cout<<“\nCube of “<<n<<” = “<<r<<endl;
getch();
}

5. /* Mujaffor Ali Sumon
ID-201420170*/

#include
using namespace std;
class power
{
public:
inline int square(int x)
{
return x*x;
}
inline int cube(int x)
{
return x*x*x;
}
};
main()
{
int x,result;
power p;

cin>>x;
result=p.square(x);
cout<<'\n';
cout<<"Square of Enter number is "<<result<<'\n'<<'\n';
cout<<"==========================="<<'\n'<<'\n';
result=p.cube(x);
cout<<"Cube of Enter number is "<<result<<'\n'<<'\n';

}

6. include
#include
using namespace std;
class power;
{
public:
int square(int n)
{
return n*n;
}
int cube(int n)
{
return n*n*n;
}
};
int main()
{
int x;
power p;
x=3;
cout<<p.square(x)<<endl;
cout<<p.cube(x)<<endl;
return 0;

}

7. /*
Md. Monir Hossain
ID-201421112
*/

#include
using namespace std;
class power
{
public:
inline int square(int x)
{
return x*x;
}
inline int cube(int x)
{
return x*x*x;
}
};
main()
{
int x,result;
power p;

cin>>x;
result=p.square(x);
cout<<'\n';
cout<<"Square of Enter number is "<<result<<'\n'<<'\n';
cout<<"==========================="<<'\n'<<'\n';
result=p.cube(x);
cout<<"Cube of Enter number is "<<result<<'\n'<<'\n';

}

201420798

/*C++ Program to Calculate Volume of a Cube 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();
}

9. Md. Khairul Hasan
201420529

#include
#include
class power
{
public:
inline int square(int n)
{
return n*n;
}
inline int cube(int n)
{
return n*n*n;
}
};
void main()
{
int n,r;
power p;
clrscr();
cout<<“\nEnter the Number: \n” ;
cin>>n;
r=p.square(n);
cout<<“\nSquare of “<<n<<” = “<<r<<endl;
r=p.cube(n);
cout<<“\nCube of “<<n<<” = “<<r<<endl;
getch();
}

10. #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();
}

Md. Imam Uddin
ID: 201420733

11. ID:201420763
MD:Rashed Prodhania
Batch : 46th

/*C++ Program to Calculate Volume of a Cube 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();
}

12. yeasmin akter
ID:201420271

Write a C++ program using class to calculate square and cube of given number using inline function :

‪#‎include‬
class power
{
public:
inline int square(int n)
{
return n*n;
}
inline int cube(int n)
{
return n*n*n;
}
};
void main()
{
int n,r;
power p;
clrscr();
cout<<“\nEnter the Number: \n” ;
cin>>n;
r=p.square(n);
cout<<“\nSquare of “<<n<<” = “<<r<<endl;
r=p.cube(n);
cout<<“\nCube of “<<n<<” = “<<r<<endl;
getch();
}

13. This comment has been removed by the author.

14. Ashraful hasan sobuj
ID-201420656

/*C++ Program to Calculate Volume of a Cube 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();
}

15. MD: Jalis Mahmud
id : 201420672

Write a C++ program using class to calculate square and cube of given number using inline function :

‪#‎include‬
class power
{
public:
inline int square(int n)
{
return n*n;
}
inline int cube(int n)
{
return n*n*n;
}
};
void main()
{
int n,r;
power p;
clrscr();
cout<<“\nEnter the Number: \n” ;
cin>>n;
r=p.square(n);
cout<<“\nSquare of “<>n;
r=p.square(n);
cout<<“\nSquare of “<<n<<” = “<<r<<endl;
r=p.cube(n);
cout<<“\nCube of “<<n<<” = “<<r<<endl;
getch();
}

16. Debashish roy
ID:201420766
C++ program to calculate simpl...

#include
class power
{
public:
inline int square(int n)
{
return n*n;
}
inline int cube(int n)
{
return n*n*n;
}
};
void main()
{
int n,r;
power p;
clrscr();
cout<<“\nEnter the Number: \n” ;
cin>>n;
r=p.square(n);
cout<<“\nSquare of “<<n<<” = “<<r<<endl;
r=p.cube(n);
cout<<“\nCube of “<<n<<” = “<<r<<endl;
getch();
}

17. Md.Rakib Hossen
ID:201421067
C++ program to calculate simpl...

#include
class power
{
public:
inline int square(int n)
{
return n*n;
}
inline int cube(int n)
{
return n*n*n;
}
};
void main()
{
int n,r;
power p;
clrscr();
cout<<“\nEnter the Number: \n” ;
cin>>n;
r=p.square(n);
cout<<“\nSquare of “<<n<<” = “<<r<<endl;
r=p.cube(n);
cout<<“\nCube of “<<n<<” = “<<r<<endl;
getch();
}

18. amenaakter
id : 201420586

Write a C++ program using class to calculate square and cube of given number using inline function :

‪#‎include‬
class power
{
public:
inline int square(int n)
{
return n*n;
}
inline int cube(int n)
{
return n*n*n;
}
};
void main()
{
int n,r;
power p;
clrscr();
cout<<“\nEnter the Number: \n” ;
cin>>n;
r=p.square(n);
cout<<“\nSquare of “<<n<<” = “<<r<<endl;
r=p.cube(n);
cout<<“\nCube of “<<n<<” = “<<r<<endl;
getch();
}

19. /*Sultana Razia
ID-201420715*/

#include
using namespace std;

inline int sq(int x)
{
return x*x;
}
inline int cube(int x)
{
return x*x*x;
}

main()
{
int x;

cout<<"Enter value made Square & Cube value"<>x;
cout<<"Square of Enter number is "<<sq(x)<<endl;

cout<<"Cube of Enter number is "<<cube(x)<<endl;

}

20. /*Sharmin Akhter
ID-201420769*/

#include
using namespace std;

inline int sq(int n)
{
return n*n;
}
inline int cube(int n)
{
return n*n*n;
}

main()
{
int n;

cout<<"Enter value made Square & Cube value"<>n;
cout<<"Square of Enter number is "<<sq(n)<<endl;

cout<<"Cube of Enter number is "<<cube(n)<<endl;

}

21. Moonmoon Hossain
ID:201420685

‪#‎include‬
class power
{
public:
inline int square(int n)
{
return n*n;
}
inline int cube(int n)
{
return n*n*n;
}
};
void main()
{
int n,r;
power p;
clrscr();
cout<<“\nEnter the Number: \n” ;
cin>>n;
r=p.square(n);
cout<<“\nSquare of “<<n<<” = “<<r<<endl;
r=p.cube(n);
cout<<“\nCube of “<<n<<” = “<<r<<endl;
getch();

22. #include
#include
class interest
{
int n;
float rate,p;
public:
void get()
{
cout<<“\nEnter principle Amount & no. of year: \n”;
cin>>p>>n;
}
void cal(float rate)
{
float si;
si=(p*n*rate)/100;
cout<<“\n\nSimple Interest is: “<<si;
}
};
void main()
{
interest i;
clrscr();
i.get();
i.cal(4.5);
getch();
}

Moonmoon Hossain
ID: 201420685

23. /*Mahmudul Hasan Nayeem
ID-201420790*/

#include
using namespace std;
class power
{
public:
inline int sq(int n)
{
return n*n;
}
inline int cube(int n)
{
return n*n*n;
}
};
main()
{
int n,result;
power p;

cin>>n;
result=p.sq(n);
cout<<'\n';
cout<<"Square of Enter number is "<<result<<'\n'<<'\n';
cout<<"==========================="<<'\n'<<'\n';
result=p.cube(n);
cout<<"Cube of Enter number is "<<result<<'\n'<<'\n';

}

24. #include
using namespace std;
class power
{
public:
inline int square(int n)
{
return n*n;
}
inline int cube(int n)
{
return n*n*n;
}
};
int main()
{
int a;
power p;
cin>>a;
cout<<p.square(a)<<endl;
cout<<p.cube(a)<<endl;
return 0;

}

25. Name-Main Uddin
ID-201421090
Batch-46

#include
#include
using namespace std;
class MainPower
{
public:
inline int Nmbsquare(int DigitNumber)
{
return DigitNumber*DigitNumber;
}
inline int Nmbcube(int DigitNumber)
{
return DigitNumber*DigitNumber*DigitNumber;
}
};
int main()
{
int DigitNumber,result;
MainPower X;
//clrscr();
cout<<"Enter the Number: \n" ;
cin>>DigitNumber;
result=X.Nmbsquare(DigitNumber);
cout<<"\n Number of Square "<<DigitNumber<<" = "<<result<<endl;
result=X.Nmbcube(DigitNumber);
cout<<"\n Number Of Cube "<<DigitNumber<<" = "<<result<<endl;
getch();
}

26. #include
using namespace std;
class power
{
public:
float square(float a)
{
return a*a;
}
float cube(float a)
{
return a*a*a;
}
};
int main()
{
float x;
power sq;
cout<<"Enter the number\n";
cin>>x;
cout<<"The square is\n";
cout<<sq.square(x)<<endl;
cout<<"The cube is\n";
cout<<sq.cube(x)<<endl;
return 0;
}

27. Name-M.R.Awal Hossain
ID-201421092
Batch-46

#include
#include
using namespace std;
class MainPower
{
public:
inline int Nmbsquare(int R)
{
return R*R;
}
inline int Nmbcube(int R)
{
return R*R*R;
}
};
int main()
{
int R,REV;
MainPower Y;
//clrscr();
cout<<"Enter the Number:" ;
cin>>R;
REV=Y.Nmbsquare(R);
cout<<"Number of Square "<<R<<" = "<<REV<<endl;
REV=Y.Nmbcube(R);
cout<<"Number Of Cube "<<R<<" = "<<REV<<endl;
getch();
}

28. Habibur Rahman
batch 46th
ID: 201421091

#include
#include
using namespace std;
class pwp
{
public:
inline int sqnumber(int i)
{
return i*i;
}
inline int cubenum(int i)
{
return i*i*i;
}
};
int main()
{
int i,saj;
pwp j;
//clrscr();
cout<<"Enter the Number:" ;
cin>>i;
saj=j.sqnumber(i);
cout<<"Number of Square "<<i<<" = "<<saj<<endl;
saj=j.cubenum(i);
cout<<"Number Of Cube "<<i<<" = "<<saj<<endl;
getch();
}

29. #include
using namespace std;
class m
{
public:
void cube(int a)
{
cout<>x;
mm.cube(x);
mm.squer(x);
}

30. sonia ferdusi
id:201410285,batch:45

#‎include‬
using namespace std;

void array_recursive(int array[],int n)
{
if(n-1>=0)
{
cout<<"Enter elements into the array:\n";
cin>>array[n];
n--;
array_recursive(array,n);
}

}

int sum_array(int array[],int n)
{
if(n==0)
{
return array[0] ;
}
return array[n]+sum_array(array,n-1);
}
int main()
{
int n;
cout<<"Enter the size of an array:\n";
cin>>n;
int array[n];
array_recursive(array,n);
cout<<"Printing Recursive Data\n";

for(int i=n; i>0; i--)
{
cout<<array[i]<<"\n";

}
cout<<"the sum is: "<<sum_array(array+1,n-1)<<endl;

}

31. sonia ferdusi
#include
using namespace std;
//float cube(float);
int main()
{
float a,cu;
cout<<"Enter input value:";
cin>>a;
cu=cube(a);
cout<<"\nCube of "<<a<<" is "<<cu;
getch();
}
float cube(float a)
{
float cu;
cu=a*a*a;
return(cu);
}

32. //Name : Sumonto Kumer Ghosh
//ID : 201410848
//Batch : 45th

#include
class power
{
public:
inline int square(int n)
{
-----------------------------
-----------------------------
}
inline int cube(int n)
{
-----------------------------
-----------------------------
}
};
void main()
{
-------------------------------
-------------------------------
}

33. #include
using namespace std;
class calculator
{
float a;
public:
float square(float a);
float cube(float a);
};
float calculator :: square(float a)
{
return a*a;
}
float calculator :: cube(float a)
{
return a*a*a;
};
int main()
{
float b;
calculator ob;
cout<<"Enter the number :"<>b;
cout<<"The square is : "<<endl;
cout<<ob.square(b)<<endl;
cout<<"The cube is :"<<endl;
cout<<ob.cube(b)<<endl;
return 0;
}

34. Marvelous and fascinating article. Incredible things you've generally imparted to us. Much obliged. Simply keep making this kind out of the post.
C plus plus Courses in Chennai

Comment Here