OPERATORS AND HEADER FILE IN C++

HEADER FILES IN C++

#include -> is used in c++ to import header files in our program. 

The reason to Introduce <iostream> :

Header file into our program is that function like "cout" and "cin" are defined in that header file.

There are two types of Header file.

1-> SYSTEM HEADER FILE : the header files which comes with compiler.ex->iostream

 2-> USER DEFINED HEADER FILE : The header files which are writen by programmer himself.

                                                                    to include out header file in the program we first need to 

                                                                 make  a header file in the current directory.

OPERATORS IN C++                                                 

Operators in c++ are used to producing output by performing various type of calculation in one or two

or more inputs.

TYPES OF OPERATORS IN C++



SOUCE CODE
//operators and header files in C++


#include <iostream>
/* agar hm control daba kr iostream pr or tb usme click krenge tb ye Header
 file khul jaygi and upper hamme dikh jayga ki ye Header file khn se
nikal ke aa rhai hai and <iostream> mai jo bhi content hai wo hame dikh
jaiga...
 -> <iostream> EK SYSTEM HEADER FILE HAI..JO KI HAMARE PROGRAM KI FUNCTIONALITY
                KO BADHATI HAI.. YANI INHANCE KARTI HAI.. */

/*their are tow types of header files..
   1. SYSTEM HEADER FILES : it comes with compiler..
   2. USER DEFINED HEADER FILES : it is written by programer*/
   
   #include "this.h" // this type we can make our own header file..
   /* agar hm khud se koi user defined header file banay
   or tb program run krway to error ayga isliy hamme apni header file
   jis naam se hai us naam ki file bana de tb program run hoo  jayga..  */
   
   
/* as a programer -> their is a wbsite(C++ REFERENCE FOR HEADER FILE..)to ceck and find the
new HEADER FILES.. -> if written DEPERECATED it means aane waale time mai iska use
     khtam ho jayga..  */

using namespace std;

    int main()
{
    cout<<endl;

    int a = 4 , b = 5 ;

    cout<<"the value of a is = "<<a<<endl<<"the value of b is = "<<b;

    cout<<endl;
    cout<<endl;

cout<<"__OPERATORS IN C++__"<<endl;

cout<<endl;

cout<<"following are the types of operators ->"<<endl;

cout<<endl;

//Arithmatic Operators...
cout<<":ARITHMATIC OPERATORS.."<<endl;

cout<<"-> Following are the types of Arithmatic operators."<<endl;

 cout<< "the value of a + b is = "<<a + b <<endl;  //Ans -> is 9..

 cout<<"the value of a - b is = "<<a-b <<endl;  //Ans-> is -1..

 cout<<"the value of a * b is = "<<a*b <<endl;  //Ans -> is 20..

cout<<"the value of a / b is = "<<a/b <<endl;
 //Ans -> is 0.. It will find QUOTIENT.. here
//in normal devide  QUOTIENT is 0.8 but in our
 //program the QUOTIENT is 0 because out data type
  // INTIGER..


cout<<"the value of a % b is = "<<a % b <<endl;
 // ans -> is 4.. the symbol name is MODULO
   // which is used in our program to find out
  // REMINDER... but in this case int 5 is not
 //able to completly devide int 4 we use 0. TO devide.

cout<<"the value of a++ is = "<<a++ <<endl;
 //jb hm a++ likhte hain tb phale -> a ki value print
   // hogi jo ki 4 hai and a ki value ke sath 1 add ho
 // jayga current now iss operator ko use krne ke baad
  // a ki value 5 hai pr print 4 hota hai.. agla hm koi
 // bhi dusra code  likhte hain to a ki value 5 hoggi..

cout<<"the value of a-- is = "<<a-- <<endl;
//yhn pe a ki value 5 hai beacause of a++ operator
// to a-- operator kya krega phale to a ki value
  // print krwayga then uske sath 1 minus kr dega
// pr is operator ke print mai a ki value 5 he print
 // hogi and agla koi bhi hm code likhenge to a ki
 // value 4 hogi.
                                           
cout<<"the value of ++a is = "<<++a <<endl;  
 // ans -> is 5..
  // jb hm ++a likhte hai to phale a ki value ke sath
  // 1 add hota and then a ki value print hoti hai..

cout<<"the value of --a is = "<<--a <<endl;
//ans -> is 4...
// phale a ki value ke sath 1- hogga then a ki value
 // print hoggi.

//ASSIGNMENT OPERATORS.
cout<<":ASSIGNMENT OPERATORS -> They are used to assign values to variables.."<<endl;

cout<<"For ex -> "<<endl << " int a = 4 ; " <<endl <<" char charcter = 'A' " <<endl;

//COMPARISON OPERATOR.
cout<<":COMPARISON OPERATORS (use PARENTHESIS Bracket to enclose the operators.)"<<endl;

cout<<"-> Following are the type of Comparison operators."<<endl;


cout<<"the value of a == b is ->"<<(a==b) <<endl;

cout<<"the value of a != b is ->"<<(a!=b) <<endl;

cout<<"the value of a >= b is ->"<<(a>=b) <<endl;

cout<<"the value of a <= b is ->"<<(a<=b) <<endl;

cout<<"the value of a > b is ->"<<(a>b) <<endl;

cout<<"the value of a < b is ->"<<(a<b) <<endl;

//simple we know that value of TRUE IS 1.. And value of FALSE IS 0..


//LOGICAL OPERATORS.
cout<<":LOGICAL OPERATORS (use double PARENTHESIS Bracket to enclose the operators.)"<<endl;
cout<<"-> Following are the type of Logical  operators."<<endl;


cout<<"the value of this Logical AND operator ((a==b) && (a<b))is -> "<<((a==b) && (a<b)) <<endl;
//both should be correct...

cout<<"the value of this Logical OR operator ((a==b) || (a<b))is -> "<<((a==b) || (a<b)) <<endl;
//One should be correct..

cout<<"the value of this Logical NOT operator (!(a==b)) is -> "<<(!(a==b)) <<endl;
//NOT operator kya kr dega ulta print krwa dega agar ans TRUE(1) to wo FALSE(0) print kr deega.


    return 0;

}
//OUTPUT
// the value of a is = 4
// the value of b is = 5

// __OPERATORS IN C++__

// following are the types of operators ->

// :ARITHMATIC OPERATORS..
// -> Following are the types of Arithmatic operators.
// the value of a + b is = 9
// the value of a - b is = -1
// the value of a * b is = 20
// the value of a / b is = 0
// the value of a % b is = 4
// the value of a++ is = 4
// the value of a-- is = 5
// the value of ++a is = 5
// the value of --a is = 4
// :ASSIGNMENT OPERATORS -> They are used to assign values to variables..
// For ex ->
//  int a = 4 ;
//  char charcter = 'A'
// :COMPARISON OPERATORS (use PARENTHESIS Bracket to enclose the operators.)
// -> Following are the type of Comparison operators.
// the value of a == b is ->0
// the value of a != b is ->1
// the value of a >= b is ->0
// the value of a <= b is ->1
// the value of a > b is ->0
// the value of a < b is ->1
// :LOGICAL OPERATORS (use double PARENTHESIS Bracket to enclose the operators.)
// -> Following are the type of Logical  operators.
// the value of this Logical AND operator ((a==b) && (a<b))is -> 0
// the value of this Logical OR operator ((a==b) || (a<b))is -> 1
// the value of this Logical NOT operator (!(a==b)) is -> 1



Comments