What does cin>> do?

I'm just curious :D! I'm a TOTAL beginner at C++, so sorry if I sound stupid :o
Last edited on
you can read about the basic I/O here:
http://www.cplusplus.com/doc/tutorial/basic_io.html

or if you want to learn more about the cin you can read here:
http://www.cplusplus.com/reference/iostream/cin.html
Start from the begining: http://www.cplusplus.com/doc/tutorial/

This forum is awesome. The tutorial is very comprehensive. :)
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>

using namespace std;

int main()
{
     string response;
     cout << "Please enter a string:" << endl;
cin >> response;

     cout << "Your string was" << response;
return 0;
}


That will look like this compiled

1
2
Please enter a string: stringtest
Your string was stringtest


cin = input, while cout = output.
@kryptonite
Don't forget to #include <string> ...
Some compilers work fine like that but others have errors without it.
Topic archived. No new replies allowed.