Buildin Function Sample Program

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

#include <iostream>

#include <cstdlib>
#include<cmath>
using namespace std;
int main ()
{
//Square Root and power of a number
cout<<"Square Root and power of a number"<<endl;
double a,b;
double sqrtA, sqrtB, powerNum;
cout<<"Enter a and b: \n";
cin>>a>>b;
sqrtA = sqrt(a);
sqrtB = sqrt(b);
cout<<fixed;
cout.precision (2);
cout<<"the square root of "<<a <<" is "<<sqrtA<<endl;
cout<<"the square root of "<<b <<" is "<<sqrtB<<endl;
powerNum = pow (a,b);
cout <<a<<" to the power of "<<b<<" is "<<powerNum<<endl;

//increment and decrement examples


cout<<" "<<endl;
cout<<"Increment and Decrement examples"<<endl;
int m=66;
cout<<"m="<<m<<endl;
m++;
cout<<"m++"<< " is "<<m<<endl;
int n=25;
cout<<"n="<<n<<endl;
n--;
cout<<"n--"<< " is "<<n<<endl;
int p=89;
cout<<"p="<<p<<endl;
p+=5;
cout<<"p+=5"<< " is "<<p<<endl;
int x=74;
cout<<"x="<<x<<endl;
x-=3;
cout<<"x-=3"<<" is "<<x<<endl;
int y=10;
cout<<"y="<<y<<endl;
y*=2;
cout<<"y*=2"<<" is "<<y<<endl;
system ("pause");
return 0;
}

You might also like