Tutorial 7



Input/Output functions in C++
cin and cout are two functions in C++ to support input and output. Inflow and outflow of data from devices to memory and memory to devices referred to as input output data stream is handled using cin and cout functions. Header file iostream.h contains cin and cout that are used to handle input and output of data in C++. << and >> are the two operators used with cout and cin respectively to handle the output and input. By default cout sends the output to the screen and by default cin receives input from keyboard.
Operators and expressions in C++ 
An operator is used to perform some mathematical operation on any data item. We have six types of operators in C++. Arithmetic Operators are addition (+), subtraction(-), multiplication(*), division(/), modulus/remainder(%). Relational operators are equa to (==), greater than (>), less than (<), greater than or equal to (>=), less than or equal to (<=), not equal to (!=). Logical operators are OR (||), AND (&&), NOT(!). Unary operators are that are used with one variable. Two operators + and – like -5 or +5 are Unary operators. Increment and decrement operators ++ and -- are used as increment and decrement operators.