answersLogoWhite

0

What is cout in c plus plus?

Updated: 8/11/2023
User Avatar

Wiki User

12y ago

Best Answer

Answer:

Difference between "cin" & "cout" is:

"cout"

"cin"It stands for console output. Console means the computer display screen. The 'cout' is a predefined object. It is used as an output statement to display output on the computer screen. It I 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.

The syntax of 'cout' is;

cout<< const1/vari1,.........................;

cout name of output stream object.

<< put to operator or insertion operator. It directs the output to the output device.

const1/var1, These are the constants and variables that are used to show output on the screen.

For e.g.

cout<<"one kilobyte="<<1024<<" bytes";

In above example two string constants, one numeric constant and three put to operators are used and its output will be: One kilobyte= 1024 bytes.

It stands for console input. It is an input stream. It is used as input statement to get input from the keyboard during execution of the program.

When an input statement is executed, the computer waits to receive an input from the keyboard. When the value is typed and enter key is pressed the value is assigned to the variable and control shifts to next statement.

It is also the part of iostream header file.

The syntax of 'cin' is:

cin>>var1 [>>var2...];

cin represents the object used as an input stream and gets the value from keyboard.

>> Extraction operator or get from operator. Its get an input from the input device and assigned t the variable.

var1, var2 represents list of variables and each variable I separated by '>>'

At least one variable on the right-hand-side of the ">>"operator must be used.

For e.g.

cin>>a>>b>>c;

User Avatar

Wiki User

13y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

cout and cin are synonymous with stdout and stdin, the global standard output and input streams, respectively. Output is normally directed to the screen (<<) while input is directed from the keyboard (>>).

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

When a program is run, three streams are opened automatically: stdin, stdout and stderr. By default, these streams are directed to the console (keyboard and screen). Thus, by default, user input will generally come from the keyboard, while program output and error messages will be sent to the screen.

cin, cout and cerr are synonymous with stdin, stdout and stderr, respectively. Since they are all streams there is no real difference between them, other than that cin is intended for input while cout and cerr are intended for output. It is clearly important that input, output and errors are all treated separately, and consistently, hence the need for separate streams.

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

cin( console input) and cout(console output) are methods of the class iostream. cin is used for getting data from the console while cout is used for printing data into the console.

For more detailed explanation, visit the link below:

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

#include <iostream>

int main()

{

std::cout << "Hello world!" << std::endl;

return(0);

}

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

Console output. It corresponds with the standard output stream (stdout) and usually means all output is directed to the screen.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is cout in c plus plus?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How you can use two input in a single statement in c plus plus?

cout&lt;&lt;"______": cin &gt;&gt;__&gt;&gt;__; [example cout&lt;&lt;"enter no."; cin&gt;&gt;a&gt;&gt;b; ]


What is the Logic to print the letters from A to Z without using printf in Turbo C plus plus?

#include&lt;iostream&gt; int main() { using namespace std; char c='A'; do { cout&lt;&lt;c; }while(c++&lt;'Z'); cout&lt;&lt;endl; }


What is the syntax of printing a value in c plus plus?

std::cout&lt;&lt;42&lt;&lt;std::endl;


How can write the name in c plus plus language without using cout statement?

I believe, you can use C-function - printf().


What is the C plus plus plus program for the addition of two numbers?

#include&lt;iostream&gt; int main() { int num1, num2; std::cout &lt;&lt; "C++ addition program" &lt;&lt; std::endl; std::cout &lt;&lt; "Enter a number: "; std::cin &gt;&gt; num1; std::cout &lt;&lt; "Enter another number: "; std::cin &gt;&gt; num2; std::cout &lt;&lt; "The sum is " &lt;&lt; num1 + num2 &lt;&lt; std::endl; }


What are the steps in c plus plus program to print word computer?

std::cout&lt;&lt;"computer"&lt;&lt;std::endl;


C plus plus code that determine prime number?

#include &lt;iostream.h&gt; main() { int a; cout&lt;&lt;"enter a number : "; cin&gt;&gt;a; cout&lt;&lt;endl; if (a%2-1) cout&lt;&lt;"it is a prime number"; else cout&lt;&lt;"it is not a prime number" return 0; } ------------------------------------------ output: enter a number : 30 it is a not a prime number


How do you say Hello World in C plus plus?

#include&lt;iostream&gt; in main() { std::cout &lt;&lt; "Hello World\n"; }


How can you write your name on c plus plus turbo v3.0?

#include&lt;iostream&gt; int main() { std::cout &lt;&lt; "Your name"; }


Example of Fibonacci in c plus plus?

#include&lt;iostream&gt; int main() { int x=0, y=1; std::cout&lt;&lt;x&lt;&lt;" "; std::cout&lt;&lt;y&lt;&lt;" "; while( y&lt;1000000 ) { std::cout&lt;&lt;(y+=x)&lt;&lt;" "; x=y-x; } std::cout&lt;&lt;std::endl; return(0); }


Fibonacci c plus plus program?

#include&lt;iostream&gt; int main() { int x=0, y=1; std::cout&lt;&lt;x&lt;&lt;" "; std::cout&lt;&lt;y&lt;&lt;" "; while( y&lt;1000000 ) { std::cout&lt;&lt;(y+=x)&lt;&lt;" "; x=y-x; } std::cout&lt;&lt;std::endl; return(0); }


How do you make C plus plus program to draw a straight line using for loop method?

void line(int length) { for(int i=0; i&lt;length; ++i) std::cout&lt;&lt;'_'; std::cout&lt;&lt;std::endl; }