2012年1月8日 星期日

ACM 10222 Decode The Mad Man

[心得] :0.004
1. ACM 10082 WERTYU差不多
2.注意大寫要轉換成小寫
3.\ 要打成\\ 上次打錯   XD!

#include <stdio.h>
#include <string.h>

int main()
{
 int c;
 char *pos;  
 char key[]="1234567890-=qwertyuiop[]\\asdfghjkl;'zxcvbnm,./";
 while((c=getchar())!=EOF)
 {       
    if(isupper(c))
       c= tolower(c);        
    pos= strchr(key,c);         
    putchar((pos)?key[pos-key-2]:c);                     
 }

 system("pause");
 //return 0;   
}

沒有留言:

張貼留言