#include <stdio.h>int main(void){ char c[128]; int i = 0, sum = 0; printf("请输入字符串\n"); do { scanf("%c", &c[i]); if (c[i] == 'x') sum++; } while ('\n' != c[i++]); printf("x的个数是%d\n", sum); return 0;}运行结果:请输入字符串wo x ni de xx的个数是2