UVA 492 - Pig-Latin

906 ワード

題意:単語の頭文字が子音である場合、最後に出力し、各単語にayを付ける
入力に注意して、getsを使おうと思ったが、ずっとceで、getcharに変えるしかなかった.
コードは次のとおりです.
#include 

using namespace std;
char x[1000005];
bool A(char c)//       
{
    return ((c>='a'&&c<='z')||(c>='A'&&c<='Z'))?true:false;
}
bool B(char c)//         
{
    return (c=='a'||c=='e'||c =='i'||c=='o'||c=='u'||c=='A'||c=='E'||c =='I'||c=='O'||c=='U')?true:false;
}
int main()
{
    int n=0,left,right,i;
    while ((x[n++]=getchar())!=EOF)
        if(x[n-1]=='
') { left=right=0;// while(x[left]) if(!A(x[left])) { cout<