用时:0ms
#include
#include
#define MAX 80
char s[MAX];
void changeChar(char *c);
int main()
{
freopen("2932.txt","r",stdin);
freopen("output.txt","w",stdout);
int i;
while(gets(s)!=NULL)//gets()的参数必须为数组?
{
if(s[0]=='#')
break;
else
{
i=0;
while(s[i]!='/0')
{
changeChar(&s[i]);
i++;
}
putchar('/n');
}
}
return 0;
}
void changeChar(char *c)
{
switch (*c)
{
case' ':
printf("%%20");
return ;
break;
case'!':
printf("%%21");
return ;
break;
case'$':
printf("%%24");
return ;
break;
case'%':
printf("%%25");
return ;
break;
case'(':
printf("%%28");
return ;
break;
case')':
printf("%%29");
return ;
break;
case'*':
printf("%%2a");
return ;
break;
default:
printf("%c",*c);
return ;
}
}