How do I take input in c++?

Started by Idris, November 17, 2016, 07:04:54 PM

Previous topic - Next topic

Omar

Hello everyone, I would like to ask you for more information, how do i take input in c++? Please kindly give me your opinion as soon as possible by return message.

Khalid

 the standard input by default is the keyboard, and the C++ stream object defined to access it is cin.

For formatted input operations, cin is used together with the extraction operator, which is written as >> (i.e., two "greater than" signs). This operator is then followed by the variable where the extracted data is stored. For example:

1
2
int age;
cin >> age;