What is input ?
stadin - - > standard input used as scanf function stdout ---> standard input used as printf function taken by monitor(gives destination) What is output :
stdout is a file pointer which is pointing to console I/O operation in C++ Example
ex : printf(“%d”,IO)// This operation performs O/P operation without using formatting specifier. printf(“%f”,1.5)
Syntax : cout<< variable/constant/expression; In order to print multiple values cout uses multiple insertion operators. Cout<value 1<value2<value 3…….
Example : # include<iostream.h> void main() { cout<< “welcome to c++”; } Eg :- #include <iostream.h> void main() { cout<<10; // cout <<10<<end l; cout<< 1.5; // cout<<1.5<<end l; cout << ‘A’; // cout<<’A’<<end l; cout<<1/5; // cout<<1.5<<end l; cout<<’A’; // cout << ‘A’ << end l; cout<< “c++” // cout << “c++” <<endl; } endl : It is a manipulator used for inserting new line
In is a back slash is escape sequences
endl |
\n |
it is called manipulator | it is called escape sequence |
It doesn’t occupy any space | It occupy 1 byte |
It is available in iostream.h | it is available in ‘C’ |
eg: # include <iostream.h> void main() { cout<<10<<1.5<<’A’<<”c++”; // cascading } Cin : It is an object of istream class.
Formatting is an implicit functionality of extract of operation
Cin >> variable –name;
The variable declared inside function is called local variable.
Eg : #include<iostream.h> void main() { int x; int Y; int Z; Cout << X << endl; cout<<Z<<endl; } o/p : The output of above program is garbage value, Because local variables are not given any default values.
eg : # include <iostream.h> void main() { int n1; cout<< “\n input n1 value”; cin >> n1; int n2; cout<< “\n input n2 value”; cin>> n2; int n3; n3=n1+n2; cout<< “\n sum is ” << n3 } C++ allows to declare block level variables
You liked the article?
Like: 0
Vote for difficulty
Current difficulty (Avg): Medium
TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.