Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
2755 孙浚轩 元音字母转换 C++ Accepted 0 MS 260 KB 779 2024-01-22 14:54:48

Tests(1/1):


Code:

#include<iostream> using namespace std; char vowel[11]={"aoeiuAOEIU"}; int casegap='a'-'A'; int main(){ int t; cin>>t; while(t--){ char c[50]; int i=0; bool d; cin>>c; while(c[i]!='\0'){ d=0; for(int j=0;j<10;j++){ if(c[i]==vowel[j]){ d=1; break; } } if(d){ if(c[i]>='a') c[i]=(char)(c[i]-casegap); }else{ if(c[i]<='Z') c[i]=(char)(c[i]+casegap); } i++; } for(int j=0;c[j]!='\0';j++) cout<<c[j]; cout<<endl; } return 0; }