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()
{
-------------------------------
-------------------------------
}
Nazmul Alam
ReplyDeleteid : 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();
}
Khandoker Mehedi Hasan
ReplyDeleteId : 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();
}
priyo nath chakma
ReplyDeleteID-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();
}
ID-201420405
ReplyDelete#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();
}
/* Mujaffor Ali Sumon
ReplyDeleteID-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;
cout<<"Enter your Number: ";
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';
}
include
ReplyDelete#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;
}
/*
ReplyDeleteMd. 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;
cout<<"Enter your Number: ";
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';
}
ReplyDeleteanik adhikary
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();
}
Md. Khairul Hasan
ReplyDelete201420529
#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();
}
#include
ReplyDelete#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
ID:201420763
ReplyDeleteMD: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();
}
yeasmin akter
ReplyDeleteID: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();
}
This comment has been removed by the author.
ReplyDeleteAshraful hasan sobuj
ReplyDeleteID-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();
}
ReplyDeleteMD: 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();
}
Debashish roy
ReplyDeleteID: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();
}
Md.Rakib Hossen
ReplyDeleteID: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();
}
amenaakter
ReplyDeleteid : 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();
}
/*Sultana Razia
ReplyDeleteID-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;
}
/*Sharmin Akhter
ReplyDeleteID-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;
}
Moonmoon Hossain
ReplyDeleteID: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();
#include
ReplyDelete#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
/*Mahmudul Hasan Nayeem
ReplyDeleteID-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;
cout<<"Enter your Number: ";
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';
}
#include
ReplyDeleteusing 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;
}
Name-Main Uddin
ReplyDeleteID-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();
}
#include
ReplyDeleteusing 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;
}
Name-M.R.Awal Hossain
ReplyDeleteID-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();
}
Habibur Rahman
ReplyDeletebatch 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();
}
#include
ReplyDeleteusing namespace std;
class m
{
public:
void cube(int a)
{
cout<>x;
mm.cube(x);
mm.squer(x);
}
sonia ferdusi
ReplyDeleteid: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;
}
sonia ferdusi
ReplyDelete#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);
}
//Name : Sumonto Kumer Ghosh
ReplyDelete//ID : 201410848
//Batch : 45th
#include
class power
{
public:
inline int square(int n)
{
-----------------------------
-----------------------------
}
inline int cube(int n)
{
-----------------------------
-----------------------------
}
};
void main()
{
-------------------------------
-------------------------------
}
#include
ReplyDeleteusing 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;
}
Marvelous and fascinating article. Incredible things you've generally imparted to us. Much obliged. Simply keep making this kind out of the post.
ReplyDeleteC plus plus Courses in Chennai
///Tisha
ReplyDelete///201930034
#include
#include
class calc
{
int x;
public:
inline void number()
{
int square,cube;
cout<<"Enter the number :";
cin>>x;
square=x*x;
cube=x*x*x;
cout<<"Square of a given number using inline function is:-"<<square;
cout<<"\n Cube of a given number using inline function is:-"<<cube;
}
};
int main()
{
calc c;
clrscr();
c.number();
getch();
return 0;
}
//Md.Nayem Hossain
ReplyDelete//Id:202010023
//63batch
#include
using namespace std;
class power
{
public:
inline int sqrt (int a)
{
return a*a;
}
inline int cube (int b)
{
return b*b*b;
}
};
int main()
{
power obj;
cout<<"The sqrt of 4 is : "<<obj.sqrt(4)<<endl;
cout<<" The cube of 4 is: "<<obj.cube(4)<<endl;
return 0;
}
//Taslima akter
ReplyDelete//Id:202010462
//Batch 63
#include
class calc
{
int a;
public:
inline void value ()
{
int square;
int cube;
cout<<"enter the value ",cin>>a;
square =a*a;
cube=a*a*a;
cout<"square of a given value is :"
<< square ;
cout<<"\n cube of a given value is:"
<<cube;
}
}
int main
{
cal c;
clscr ();
c.value();
getch ();
return 0;
}
//Murshida akter
ReplyDelete// Id 202010463
// Batch 63
#include
using namespace std;
class power
{
private:
int val:
public:
void get_val()
{
cout<<"\n enter the number :";
cin>>val;
}
inline int square ()
{
cout <<"\n square of "<<val<<"=";
return val*val;
}
};
int main()
{
int result ;
power p;
p.get_val();
result =p.square();
cout<<result<< endl;
result =p.cube();
cout<<result <<endl;
return 0;
}
//Murshida akter
ReplyDelete// Id 202010463
// Batch 63
#include
using namespace std;
class power
{
private:
int val:
public:
void get_val()
{
cout<<"\n enter the number :";
cin>>val;
}
inline int square ()
{
cout <<"\n square of "<<val<<"=";
return val*val;
}
};
int main()
{
int result ;
power p;
p.get_val();
result =p.square();
cout<<result<< endl;
result =p.cube();
cout<<result <<endl;
return 0;
}
//jamil zilani
ReplyDelete//201930092
#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;
}
https://drive.google.com/file/d/13-ErHCJh742Qsopku2e3SDjLhSiUnKCu/view?usp=sharing
ReplyDelete#include
ReplyDelete#include
///FARJANA KAMAL KONOK
///201930701
///62 BATCH
class p0WER
{
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();
}