Absolute value (abs) :-
This function is used to absolute value of a numbers. The absolute means positive value.
#include<conio.h>
#include<math.h>
Void main ()
{
Clrscr();
Float a, res;
Cout<<"Enter value for a";
Cin>>a;
res=abs (a) ;
Cout<<"result is"<<res;
getch();
}
Void main ()
{
Clrscr();
Float a, res;
Cout<<"Enter value for a";
Cin>>a;
res=abs (a) ;
Cout<<"result is"<<res;
getch();
}
Note:- abs is used only for numeric value.
πOutput:-
Input is : Enter value for a 5.6
Output is :- 5
Input is : Enter value for a 7.9
Output is: 7
Absolute value (fabs)
This function is used to find the absolute value of decimal variables.
Syntax :-
#include<iostream.h>
#include<conio.h>
#include<math.h>
Void main()
{
Clrscr();
Float a, res;
Cout<<"Enter value for a";
Cin>>a;
res=fabs(a) ;
Cout<<"Result is"<<res;
getch() ;
}
πOutput:-
Input :- Enter value for a -9
Output:- 9
Input :- Enter value for a -4
Output:- 4
Floor (value)
This function is round down value.
#include<iostream.h>
#include<conio.h>
#include<math.h>
Void main ()
{
Clrscr() ;
Float a, res;
Cout<<"Enter value for a":
Cin>>a;
res=floor(a);
Cout<<"Result is "<<res;
Getch();
}
πOutput :-
Input :- Enter value for a 6.6
Output:- 6
Input :- Enter value for a 4.5
Output:- 4
Ceil (value)
This function round up the nearest numberic number value.
#include<iostream.h>
#include<conio.h>
#include<math.h>
Void main ()
{
Clrscr();
Float a, res;
Cout<<" Enter value for a ";
Cin>>a;
res=ceil (a) ;
Cout<<"Result is"<<res;
Getch() ;
}
πOutput:-
Input :- Enter value for a 5.9
Output:- 6
Input :- Enter value for a 4.7
Output:- 5
Fmod (divident and divider)
This function is used to remainder of decimal value.
#include<iostream.h>
#include<conio.h>
#include<math.h>
Void main ()
{
Clrscr() ;
Float a, res;
Cout<<"Enter value for a";
Cin>>a;
res=F mod (a, 5) ;
Cout<<"Result is "<<res;
Getch() ;
}
πOutput:-
Input :-Enter value for a 13
Output:- 1
Input :-Enter value for a 21
Output:- 2
After understanding these diffrent type of mathematical operator then solve some examples based on it..
Example 1: Write a programme to find cos value converting in radiun ??
Answer :
#include<iostream.h>
#include<conio.h>
Void main ()
{
Clrscr() ;
Float a, res;
Cout<<" Enter value for a ";
Cin>>a;
res=cos(a*3.14/180) ;
Cout<<" Result is "<<res;
getch() ;
}
πOutput:-
Input :- Enter value for a 2
Output:- 0.999391
Endl
Endl stands for end of the line it is a manipulator function used to insert a new line character.
#include<iostream.h>
#include<conio.h>
Void main ()
{
Clrscr() ;
Cout<<" I like computer "<<endl;
Cout<<" It is best subject "<<endl;
Cout<<" Learn computer subject every time ";
getch() ;
}
πOutput
Output:- I like computer
It is best subject
Learn computer subject every time.
Slash (\n)
Slash (\) n stands for end of the line it also works on as endl.
#include<iostream.h>
#include<conio.h>
Void main ()
{
Clrscr() ;
Cout<<" Hello\n hii\n welcome to by experts\n learn in c++ here\n Thank you ";
Getch() ;
}
πOutput:-
Output:- hello
hii
welcome to by experts
learn in c++ here
Thank you.
Slash(\) t
It is stands for tab character.
#include<iostream.h>
#include<conio.h>
Void main()
{
Clrscr() ;
Cout<<"hello\t hii\t welcome you by experts\t learn in c++ here \t Thank you ":
Getch () ;
}
πOutput:-
Output:- hello hii welcome to by experts learn in c++ here Thank you.
Slash (\) b:-
It is stands for backspace character . It takes the cursor one character backward. So that when you will type next thing the character ahead of cursor will be Overwritten.
#include<iostream.h>
#include<conio.h>
Void main ()
{
Clrscr() ;
Cout<<"hello\b hii ";
Getch () ;
}
πOutput:-
Output:- hellhii
Slash (\) r:-
slash (\) r stands for carriage return. It simply moves the coursor to the starting of the current line.
#include<iostream.h>
#include<conio.h>
Void main ()
{
Clrscr() ;
Cout<<" Jharkhand\r experts ";
Getch() ;
}
πOutput:-
Output:- Expertskhand
Note:-
These all are called special formatting character.
Manupulation Operators
Set w:-
Set w stands for set width we can set width of any display.
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
Void main ()
{
Clrscr() ;
Cout<<"set w (40) <<"Jharkhand ";
getch() ;
}
πOutput:-
Output:- Jharkhand
Note:-
Set w is the manipulator oprator..
Our website:
π https://codemasternisha.blogspot.com/π
Importants concept about C++ Programming...
π IF you want to know How to solve Complex type of mathematical Problem in C++
Programming CLICK HERE
if you face any any problem or any issue about our website then fill the contact us page and write your issues in it ...
πππππππππππππ
KEEP SUPPORTING π !! KEEP LEARNING π !!
πππππππ
0 Comments