#include <iostream> using namespace std; int main() { char str[100] = { 0 }; // 最多可以读取sizeof(str) - 1个字符,最后一个字符留给NULL cin.getline(str, sizeof(str)); // write your code here...... int size = 0; for (char *p = str; *p != NULL; ++p) { ++size; } cout << size; return 0; }