#include <iostream> #include <stdio.h> using namespace std; int main() { char str[100] = { 0 }; cin.getline(str, sizeof(str)); // write your code here...... char* pc = str; int count = 0; while(*pc != '\0') { count++; pc = pc + 1; } printf("%d", count); return 0; }
这里给出了输入函数cin.getline(),我们只需要完成下面的判断部分就好了