注意事项:很菜鸟的做法。直接用字符数组来存储了。应该就是考一下判断语句的使用吧!
参考代码:
#include<iostream> #include<cstring> using namespace std; int main() { char str[100]; while(cin>>str) { if(strlen(str)==3&&str[0]=='E'&&str[1]=='N'&&str[2]=='D') break; else { for(int i=0;i<strlen(str);i++) { if(str[i]=='A'||str[i]=='W'||str[i]=='F') str[i]='I'; else if(str[i]=='C') str[i]='L'; else if(str[i]=='M') str[i]='o'; else if(str[i]=='S') str[i]='v'; else if(str[i]=='D'||str[i]=='P'||str[i]=='G'||str[i]=='B') str[i]='e'; else if(str[i]=='L') str[i]='Y'; else if(str[i]=='X') str[i]='u'; } } cout<<str<<endl; } return 0; }
0.0分
0 人评分