cout output
#include <iostream> using namespace std; intmain () { cout << " hello c++ " << ' ' << 12 ; // Can continuously output cout << ' a ' << 12.123 << endl; // Automatically identify the type int a = 12; char b = 'b'; float f = 123.12f; cout << a << b << f; system("pause"); return 0; }
endl newline character
#include <iostream> using namespace std; intmain () { cout << " hello c++ " << endl; // wrap the line and clear the buffer cout << " hello c++ " << ' \n ' ; // \n newline system( " pause " ); return 0 ; } // endl adds an operation to refresh the buffer, this operation will cause the buffered characters to be displayed on the screen immediately. // \n does not guarantee this, that is to say, on some operating systems, the display of \n will be slower, and these commonly used systems will not hide it, but it is no different from endl. // For example, the characters entered by the keyboard,
cin input
#include <iostream> using namespace std; intmain () { char c; int a; double d; cin >> c; cout << c; cin >> c >> a >> d; cout << c << ' ' << a << ' ' << d << endl; system("pause"); return 0; }