| ||||||||||
| 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 | |||||||||
哪位高手帮我看看,总是wrong answer,谢过了#include <stdio.h>
#include <string.h>
char decode(char target);
char* clear(char* target);
int main(void){
char formatted_string[100][200];
char current_word[100];
char decode_current_word[100];
char current_line[200] = "\0";
int i;
int line =0;
while(strcmp(current_word,"ENDOFINPUT")){
scanf("%s",current_word);
if(!strcmp(current_word,"START")){
continue;
}else if(!strcmp(current_word,"END")){
strcpy(formatted_string[line],current_line);
line++;
current_line[0] = '\0';
}else if(!strcmp(current_word,"ENDOFINPUT")){
continue;
}else{
for(i=0;current_word[i] != '\0';i++){
if((64<current_word[i]) && (current_word[i]<91)) decode_current_word[i] = decode(current_word[i]);
else {
decode_current_word[i] = current_word[i];
}
}
decode_current_word[i] = '\0';
strcat(current_line,decode_current_word);
strcat(current_line," ");
decode_current_word[0] = '\0';
}
}
for(i=0;i<3;i++){
printf("%s\n",formatted_string[i]);
}
}
char decode(char target){
if(target < 70) return target+21;
else return target-5;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator