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 <stdio.h> # include <string.h> char buf[105]; /* " " (space) %20 "!" (exclamation point) %21 "$" (dollar sign) %24 "%" (percent sign) %25 "(" (left parenthesis) %28 ")" (right parenthesis) %29 "*" (asterisk) %2a */ void p(char *s) { printf("%s", s); } int main() { int i; while (fgets(buf, 105, stdin), strcmp(buf, "#\n")!=0) { for (i = 0; buf[i]; ++i) { switch(buf[i]) { case ' ': p("%20");break; case '!': p("%21");break; case '$': p("%24");break; case '%': p("%25");break; case '(': p("%28");break; case ')': p("%29");break; case '*': p("%2a");break; default: putchar(buf[i]);break; } } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator