Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
打表附代码#include <cstdio> #include <cstring> const char dic2[]=" ; M0,.9 12345678 L - \\VXSWDFGUHJKNBIO=EARYCQZT'P]["; char str[1000]; int main() { int i,j,l; while (gets(str)!=NULL) { l=strlen(str); for (i=0;i<l;i++) printf("%c",dic2[str[i]-' ']); printf("\n"); } } =================================================================== 表生成器兼更容易理解的打表: #include <cstdio> #include <cstring> const char dic[]=" 1234567890-=QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,./"; char str[1000]; int main() { int i,j,l,l2=strlen(dic); while (gets(str)!=NULL) { l=strlen(str); for (i=0;i<l;i++) { for (j=1;str[i]!=dic[j] && j<l2;j++); if (j<l2) printf("%c",dic[j-1]); else printf(" "); } printf("\n"); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator