CONSTANT
Constant in c++ are fixed value which we are not able to change them in our program.
example -> const float pi = 3.14;
MANIPULATORS
In c++ manipulators are used in the formatting of output.
example of manipulators are -> endl and setw
//OPERATOR PRECEDENCE & MANIPULATOR...
#include <iostream>
#include<iomanip> // we include <iomanip> for use of setw manipulator in our program..
using namespace std;
int main(){
cout<<endl;
cout<<"___CONSTANTS(const) IN C++___"<<endl;
cout<<endl;
cout<<"-> constants in c++ are fixed values we are not able to change them in our program. "<<endl;
const float pi = 3.14;
cout<<":the value of pi is -> "<<pi<<endl;
//pi = 3.144 ; // we are not able to change contant. so error will occour because pi is constant...
cout<<endl;
cout<<"***MANIPULATOTS IN C++***"<<endl;
cout<<endl;
cout<<"-> Manipulators are operators which help us to edit our data display."<<endl;
cout<<"-> types of manipulators -> endl and setw"<<endl;//to use setw we have to include <iomanip> header file
int a = 3, b = 33 ,c = 333;
cout<<endl;
cout<<"***WITHOUT SETW OPERATOR. "<<endl;
cout<<endl;
cout<<":the value of a is = "<<a<<endl; // WITHOUT
cout<<":the value of b is = "<<b<<endl; // SETW
cout<<":the value of c is = "<<c<<endl; // OPERATOR
cout<<endl;
cout<<"***WITH SETW OPERATOR. "<<endl;
cout<<endl;
cout<<"the value of a is = "<<setw(4)<<a<<endl; // WITH
cout<<"the value of b is = "<<setw(4)<<b<<endl; // SETW
cout<<"the value of c is = "<<setw(4)<<c<<endl; // OPERATOR
//So yhn pe 4 ks space milega....
cout<<endl;
cout<<"___OPERATOR PRECEDENCE__";
int d = 6, e = 9;
//int f = (d*5)+e;
int f = (((d*3)+e)-17);//to phale kya solve hogga ye sb depend krta hai
//PRECEDENCE TABLE OF C++ PE...
//phale wo solve hogga jo table mai upper hotta hai..
cout<<endl;
cout<<"the value of (((d*3)+e)-17) -> ";
cout<< f;
cout<<endl;
cout<<endl;
return 0;
}
//OUTPU___CONSTANTS(const) IN C++___
-> constants in c++ are fixed values we are not able to change them in our program.
:the value of pi is -> 3.14
***MANIPULATOTS IN C++***
-> Manipulators are operators which help us to edit our data display.
-> types of manipulators -> endl and setw
***WITHOUT SETW OPERATOR.
:the value of a is = 3
:the value of b is = 33
:the value of c is = 333
***WITH SETW OPERATOR.
the value of a is = 3
the value of b is = 33
the value of c is = 333
___OPERATOR PRECEDENCE__
the value of (((d*3)+e)-17) -> 10
Comments
Post a Comment