Tutorial: Input / Output
Standard output:
Cout is the standard output.
It's used like this:
cout << "Hello";
You can also output numbers and variables.
cout << 23 << endl;
cout << variable << endl;
The « (Insertion Operator) can be used more than once in a statement.
cout << "Hello, my name is " << name << " and i'm " << age << " years." << endl;
Standard input:
Cin is the standard input.
It's used like this:
string str;
cin >> str;
Example:
#include <iostream> using namespace std; int main() { string str; cout << "Whats's your favourite food? "; cin >> str; cout << "Cool, I love " << str << " too.\n"; return 0; }
| Categories: Beginner Tutorials : Tutorials |
page_revision: 4, last_edited: 1245766438|%e %b %Y, %H:%M %Z (%O ago)