题目描述
字符串处理问题,也很简单
需要注意字符串的读取 用C语言getchar读取一直不对。。。。
#include<iostream>
#include<string>
#include<set>
using namespace std;
bool vow(char x)
{
x=toupper(x);
if(x=='A'||x=='E'||x=='I'||x=='O'||x=='U')return 1;
return 0;
}
int main(){
string s;
string temp="";
while(getline(cin,s)){
int i=0;
while(i<s.size())
{
if(isalpha(s[i]))
{
bool flag=1;
char fir;
if(vow(s[i])) flag=0;
else fir=s[i++];
while(isalpha(s[i]))
cout<<s[i++];
if(flag)
cout<<fir;
cout<<"ay";
}
else{
cout<<s[i++];
}
}
cout<<endl;
}
return 0;
}