UVA10082

将键盘正确顺序放入数组,查找时i-1位即为正确位置
注意除了数组中输入和空格外 还有其他输入
`#include

include

using namespace std;

int main()
{
char s[] = "`1234567890-=QWERTYUIOP[]\ASDFGHJKL;'ZXCVBNM,./";
char c;
int f;
int l=strlen(s);
while((c=getchar())!=EOF){
f=0;
for(int i=0;i<l;i++){
if(c= =s[i]){
cout<<s[i-1];
f=1;
}
}
if(f= =0) cout<<c;//可能会有除了空格和表中其他的输入

}

}
`

posted @ 2021-08-22 22:00  lwx_R  阅读(26)  评论(0编辑  收藏  举报