Search:

Submit Article

# Program to illustrate the use of some builtin functions of header file <math.h>.

Posted By: Easy Tutor     Category: C++ Programming     Views: 3382

## Code for Program to illustrate the use of some builtin functions of header file &lt;math.h&gt;. in C++ Programming

``` #include<iostream.h>
#include<conio.h>
#include<math.h>

main( )
{
clrscr();

cout<<"\n  Use of Some Builtin functions \n\n";

cout<<"\n ************** Use of abs,fabs *******************\n"<<endl;
cout<<"\t Absolute value of -5 = "<<abs(-5)<<endl;

cout<<"\t Absolute value of -4.43 = "<<fabs(-4.43)<<endl;

getch();

cout<<"\n ********** Use of ceil and floor *************\n"<<endl;
cout<<"\t Rounded value of 4.43 to next number = "<<
ceil(4.43)<<endl;
cout<<"\t Rounded value of 4.43 to previous number = "<<
floor(4.43)<<endl;

getch();

cout<<"\n *********** Decimal Code of Characters *******\n"<<endl;
cout<<"\t Code of A is "<<int('A')<<endl;
cout<<"\t Code of B is "<<int('B')<<endl;
cout<<"\t Code of C is "<<int('C')<<endl;

getch();

cout<<"\n ******* Use of Trigonometric Functions ******\n"<<endl;
cout<<"\t Value of Sin(0) = "<<sin(0)<<endl;
cout<<"\t Value of Cosine(0) = "<<asin(0)<<endl;
cout<<"\t Value of Cos(0) = "<<cos(0)<<endl;
cout<<"\t Value of Sec(0) = "<<acos(0)<<endl;
cout<<"\t Value of Tan(0) = "<<tan(0)<<endl;
cout<<"\t Value of Cot(0) = "<<atan(0)<<endl;

getch();

cout<<"\n ******** Use of log(x)=ln and log10(x)=log *********\n\n";
cout<<"\t Log(10)=ln(10) =  "<<log(10)<<endl;

cout<<"\t Log10(10) = log(10) = "<<log10(10)<<endl;

getch();

cout<<"\n ************* Use of pow(x^n) ********************\n"<<endl;
cout<<"\t Value of 2 power 3 is pow(2^3) = "<<pow(2,3)<<endl;

getch();

cout<<"\n ************* Use of pow(10^n) ********************\n"<<endl;
cout<<"\t Value of 10 power 5 is pow(10^5) = "<<pow10(5)<<endl;

cout<<"\n ************* Use of exp(e^n) *********************\n"<<endl;
cout<<"\t Value of e power 4 is exp(e^4) = "<<exp(4)<<endl;

getch();
return 0;
}
```
Share:

 Easy Tutor author of Program to illustrate the use of some builtin functions of header file . is from United States. Easy Tutor says Hello Friends,I am Free Lance Tutor, who helped student in completing their homework. I have 4 Years of hands on experience on helping student in completing their homework. I also guide them in doing their final year projects.I have share many programs on this website for everyone to use freely, if you need further assistance, than please contact me on easytutor.2ya [at the rate] gmail [dot] comI have special discount scheme for providing tutor services. I am providing tutor service to students from various contries, currently most of my students are from United States, India, Australia, Pakistan, Germany, UK and Canada. I am also here to expand my technical network to receive more opportunity in my career, make friends to help them in resolving their technical problem, learn and share my knowledge, If you like to be my friend, Please send me friend request.Thanks,Happy Programming :) View All Articles

 Please enter your CommentComment should be atleast 30 Characters.Please put code inside [Code] your code [/Code]. No Comment Found, Be the First to post comment!