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 |
Re:why Presentation Error?In Reply To:Re:why Presentation Error? Posted by:xiaoha at 2005-09-08 17:36:15 这是我的代码,麻烦看一下输出格式那里有错?我崩溃了!thx!!! #include<stdio.h> #include<string.h> char key[27],tran[81],tranto[81]; int main() { int i,count=0,len; scanf("%s",key); while(1==scanf("%s",tran)) { count++; len=strlen(tran); for(i=0;i<len;i++) { if(tran[i]>90) { tranto[i]=key[tran[i]-97]; } else { tranto[i]=key[tran[i]-65]; tranto[i]-=32; } } tranto[len]=0; if(count==1) { printf("%s",tranto); } else { printf(" %s",tranto); } } printf("\n");//°把这行去了,还是PE!啊 return 0; } > 我觉得你可以一个字符一个字符的读入,也可以整体读入,这样处理起来方便一些,如果把整个字符串分成小的字符串,再输出,比较容易出问题 Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator