想啥呢Word哥!没有幽默感的骆驼就像纸糊的鹰酱一样(非黑即白),Beyond time and space, your name!
#include <stdio.h> #include <iostream> #include <string> using namespace std; int main() { //no need to use, but it's ok //std::cout << "Hello World!\n"; string s1("Hello,world!\n"); cout << s1; //endl string word; while (cin >> (word)) { //to test '\0' //please enter 'ctrl+z' cout << word << endl; } //attention the following exp cin.clear(); //auto and for : string str("some string"); for (auto c : str) { cout << c << endl; } //some func by str cout << str.size() << endl; cout << str.length() << endl; //str's func //excuse me, can not running string results; string::size_type n; const string hexdigits = "0123456789ABCDEF"; //cout << "Please enter digits:"; while (cin >> n) { if (n < hexdigits.size()) { results += hexdigits[n]; } } //redo cin.clear(); cout << results; for (auto& cc : hexdigits) { cout << cc << endl; } return 0; }