4. Prepared By: Asst. Prof. Sejal Jadav
Output Operator/Insertion
Operator/Put-to Operator [<<]
• printf(“Sample C++ program”); //C
• cout << “Sample C++ program”; //C++
• The statements cause the string in quotation marks to be
displayed on screen.
• But here in C++ ‘cout’
5. Prepared By: Asst. Prof. Sejal Jadav
•[C out] is a predefined object that
represents the standard output
stream.
•Here standard output stream
represents the screen.
•The operator << is called the
‘insertion’ or ‘put to’ operator.
•It inserts the contents of the
variable to the object.
6. Prepared By: Asst. Prof. Sejal Jadav
Input Operator/Extraction
Operator/Get-from Operator [>>]
• scanf(“%d”,&no1); //C
• cin >> no1; //C++
• The statement causes the program to wait for the user to
type in a number which will be placed in a variable.
7. Prepared By: Asst. Prof. Sejal Jadav
• The identifier cin [C in] is a predefined object that
corresponds to the standard input stream.
• Here standard input stream represents the keyboard.
• The operator >> is called ‘Extraction’ or ‘Get-from’
Operator.
• It extracts the value from the keyboard and assigns it to
the variable.