题目:修改统计元音字母的程序,使其能统计以下含有两个字符的字符序列的数量:ff,fl,fi。
#include<iostream>
using namespace std;
int main()
{
char ch;
int ffcnt, flcnt, ficnt;
ffcnt = flcnt = ficnt = 0;
while (cin >> ch)
{
switch (ch)
{
case'f':while (cin >> ch)
{
switch (ch)
{
case'f':++ffcnt;
break;
case'l':++flcnt;
break;
case'i':++ficnt;
break;
}
break;
}
}
}
cout << "ff有" << ffcnt << "个" << endl
<< "fl有" << flcnt << "个" << endl
<< "fi有" << ficnt << "个" << endl;
return 0;
}