इससे पहले operator article मे , basic mathematically operation addition , subtraction , multiplication और division को discuss किया है लेकिन जब advance operation के power , square , cube , trigonometric value को find करने के लिए math class के pre-define function को use किया जाता है | इस class मे निन्म function होता है :
pow()
इस function का use power को find करने के लिए किया जाता है | जैसे 2 की power 3 होती है इस expression का पुत्पुत को find करने के लिए pow() function को use करते है |
power (base , power ) ;
‘यहा पर
pow() ; ये pow function है जिसका use power value को find किया जाता है |
base : ये variable का नाम है जो power expression मे base की तरह कार्य करता है |
power : ये variable का नाम है जो power expression मे power की तरह कार्य करता है |
इसका उदाहरन होता है :
#include<iostream.h>
#include<conio.h>
void main()
{
int base ,power ;
cout<<“Enter Base : “;
cin>>base;
cout<<“Enter Power : “;
cin>>power;
int value1 = power (base,power);
base=12;
power = 3;
int value1 = power (base,power);
cout<<“first power Expression output :”<<value1<<endl
cout<<“Second power Expression output :”<<value2 <<endl;
}
getch();
}
इसके उदाहरन मे , यूजर द्वारा दो value को input किया जाता है | इन value को power , base मे assign किया जाता है | और इस
int value1 = power (base,power); इस statement से power expression की value को calculate किया जाता है |
int value2 = power (base,power); इस statement से second power expression की value को calculate किया जाता है |
इसका आउटपुट होगा :
Enter Base : 30
Enter Power : 2
first power Expression output : 900
Second power Expression output : 144
square ()
इस function का use किसी value ]square value को find करने के लिए किया जाता है | square () function का use power function की तरह किया जाता है |लेकिन इस function मे power की value हमेशा ‘2’ होती है |इसका syntax निन्म होता है :
square(value);
‘यहा पर
square() ; ये square function है जिसका use square value को find किया जाता है |
value : ये variable है जिसका square value को find किया जाता है |
इसका उदाहरन होता है :
#include<iostream.h>
#include<conio.h>
void main()
{
int v1 , v2 ;
cout<<“Enter value 1 : “;
cin>>v1;
cout<<“Enter value2 : “;
cin>>v2;
int value1 = square (v2);
int value1 = power ( v1 );
cout<<” square output of v1 :”<<value1<<endl
cout<<“square output of v2 :”<<value2 <<endl;
}
getch();
}
इसके उदाहरन मे , यूजर द्वारा दो value को input किया जाता है | इन value को power , base मे assign किया जाता है | और इस
int value1 = square (v2);; इस statement से first square expression की value को calculate किया जाता है |
int value1 = power ( v1 );; इस statement से second square expression की value को calculate किया जाता है |
इसका आउटपुट होगा :
Enter value 1 : 12
Enter value 2 : 13
square output of v1 : 144
square output of v2 : 169
cube()
इस function का use किसी value का cubevalue को find करने के लिए किया जाता है | cube() function का use power function की तरह किया जाता है |लेकिन इस function मे power की value हमेशा ‘2’ होती है |इसका syntax निन्म होता है :
cube(value);
‘यहा पर
cube() ; ये cube function है जिसका use cube value को find किया जाता है |
value : ये variable है जिसका cube value को find किया जाता है |
इसका उदाहरन होता है :
#include<iostream.h>
#include<conio.h>
void main()
{
int v1 , v2 ;
cout<<“Enter value 1 : “;
cin>>v1;
cout<<“Enter value2 : “;
cin>>v2;
int value1 = cube(v2);
int value1 = power ( v1 );
cout<<” cube output of v1 :”<<value1<<endl
cout<<“cube output of v2 :”<<value2 <<endl;
}
getch();
}
इसके उदाहरन मे , यूजर द्वारा दो value को input किया जाता है | इन value को power , base मे assign किया जाता है | और इस
int value1 = cube(v2);; इस statement से first cubeexpression की value को calculate किया जाता है |
int value1 = power ( v1 );; इस statement से second cubeexpression की value को calculate किया जाता है |
इसका आउटपुट होगा :
Enter value 1 : 2
Enter value 2 : 5
cube output of v1 : 8
cube output of v2 : 125
log()
इस function का use किसी value का log value को find करने के लिए किया जाता है | log() function का use power function की तरह किया जाता है |इसका syntax निन्म होता है :
log(value);
‘यहा पर
log() ; ये log function है जिसका use log value को find किया जाता है |
value : ये variable है जिसका log value को find किया जाता है |
इसका उदाहरन होता है :
#include<iostream.h>
#include<conio.h>
void main()
{
int v1 , v2 ;
cout<<“Enter value 1 : “;
cin>>v1;
cout<<“Enter value2 : “;
cin>>v2;
int value1 = log(v2);
int value1 = power ( v1 );
cout<<” log output of v1 :”<<value1<<endl
cout<<“log output of v2 :”<<value2 <<endl;
}
getch();
}
इसके उदाहरन मे , यूजर द्वारा दो value को input किया जाता है | इन value को power , base मे assign किया जाता है | और इस
int value1 = log(v2);; इस statement से first logexpression की value को calculate किया जाता है |
int value1 = power ( v1 );; इस statement से second logexpression की value को calculate किया जाता है |
इसका आउटपुट होगा :
Enter value 1 : 12
Enter value 2 : 13
log output of v1 : 144
log output of v2 : 169
Square Root()
इस function का use किसी value का Square Root value को find करने के लिए किया जाता है | Square Root() function का use power function की तरह किया जाता है |इसका syntax निन्म होता है :
Sqrt(value);
‘यहा पर
Sqrt() ; ये Square Root function है जिसका use Square Root value को find किया जाता है |
value : ये variable है जिसका Square Root value को find किया जाता है |
इसका उदाहरन होता है :
#include<iostream.h>
#include<conio.h>
void main()
{
int v1 , v2 ;
cout<<“Enter value 1 : “;
cin>>v1;
cout<<“Enter value2 : “;
cin>>v2;
int value1 = Sqrt(v1);
int value1 = Sqrt(v2);
cout<<” Square Root output of v1 :”<<value1<<endl
cout<<“Square Root output of v2 :”<<value2 <<endl;
}
getch();
}
इसके उदाहरन मे , यूजर द्वारा दो value को input किया जाता है | इन value को power , base मे assign किया जाता है | और इस
int value1 = Square Root(v2);; इस statement से first Square Rootexpression की value को calculate किया जाता है |
int value1 = Sqrt(v2); इस statement से second Square Root expression की value को calculate किया जाता है |
इसका आउटपुट होगा :
Enter value 1 : 12
Enter value 2 : 13
Square Root output of v1 : 144
Square Root output of v2 : 169
इस article मे , math class के function को discuss किया गया है अब आगे के article मे , math class के कुछ और function को discuss करेगे |