编写一个程序读取输入,读到#为止,报告ei字符串出现的次数,用switch解决

    技术2023-12-17  65

    #include <stdio.h> int main() { int n = 0; char ch,pre; while(scanf("%c",&ch) && ch != '#') { switch(ch) { case 'i':if(pre == 'e') n++; default:pre = ch; } } printf("ei共出现%d次",n); return 0; }
    Processed: 0.009, SQL: 9