Anonymous

Which Output Statement Is Used In C++ Language?

3

3 Answers

Afzaal Ahmad Profile
Afzaal Ahmad answered
The standard input statement in C++ is cin.
The structure of cin is

cin>>obj;

where obj can be any variable, any class object, any pointer.

For example

int a;
cin>>a; //any value entered by user will be stored in a.
saima jabeen Profile
saima jabeen answered
The "cin" Object------Input Stream
The "cin" stands for console input. It is pronounced as "See In". It is an input stream. It is used as input statement to get input from the keyboard during program execution.
When an input statement is executed, the computer waits to receive an input from keyboard. When a value is typed and enter key is pressed, the value is assigned to the variable and control shifts to the next statement.
The "cin" object is also a part of iostream header file.
The syntax of "cin" is:
Cin>> var1 [>>var2……..];
Cin: It represents the object name used as an input stream. This stream represents data coming from input device keyboard.

>>: It is extraction operator or get from operator. It gets an input from the input device and assigns it to the variable.
Var1, var2: These represent list of variables. Each variable is separated by extraction operator ">>". Usually a separate statement is used for each variable.
At least one variable on the right hand side of the ">>" operator must be used. The use of other variables is optional.
For example, to input data into variables a, b, c, the input statement si written as
Cin>> a>>b>>c;
When this statement is executed,"Enter" key is pressed after typing data for each variable.
saima jabeen Profile
saima jabeen answered
The "cout" object____ Output Stream
The "cout" is pronounced as "See out". The "cout" stands for console output. The console represents the computer display screen.
The "cout" is a C++ predefined object. It is used as an output statement to display output on the computer screen. It is a part of iostream header file.

Flow of data from one location to another location is called stream. The "cout" is the standard output stream in c++. This stream sends the output to the computer screen.
The syntax of cout is:
cout<< const1/var1, const2/var2;
Cout: It is the name of output stream object.
<<: Put to operator or insertion operator. It directs the output-to-output device.
Const1/var1, const2/var2: It is the list of constants, variables or arithmetic expression or each variable or constant, separate operator "<<" is used.

The string constants are given in double quotation marks. Numeric constants, variables and expressions are given without quotation marks e.g.:
cout << "One kilobyte = "<<1204<<"bytes";
In the above statements, two string constants, one numeric constant and three put to operators(<<) have been used. The output of the above statement will be:
One kilobyte= 1024 bytes

Answer Question

Anonymous