放了一个长长的暑假,可能是这辈子最后一个这么长的暑假了吧,呵呵。。。今天来实验室了,先找了zoj上面简单的题目练练手直接贴代码了,不解释,就是一道简单的密文转换问题:
#include <stdio.h> #include <string.h> int main() { char cText[1000]; char start[10]; char end[5]; while(scanf("%s",start)!=EOF&&strcmp(start,"ENDOFINPUT")!=0) { getchar(); gets(cText); scanf("%s",end); int i=0; while(cText[i]!=' ') { if(cText[i]>=70&&cText[i]<=90) { cText[i]-=5; } else if(cText[i]>=65&&cText[i]<70) { cText[i]=90-4+(cText[i]-65); } i++; } printf("%s ",cText); } return 0; }