What does cin>> do?

Aug 30, 2008 at 10:48pm
I'm just curious :D! I'm a TOTAL beginner at C++, so sorry if I sound stupid :o
Last edited on Aug 30, 2008 at 10:48pm
Aug 30, 2008 at 11:05pm
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
Aug 31, 2008 at 3:26am
Start from the begining: http://www.cplusplus.com/doc/tutorial/

This forum is awesome. The tutorial is very comprehensive. :)
Aug 31, 2008 at 4:02am
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.
Aug 31, 2008 at 12:08pm
@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.