![](https://img-my.csdn.net/uploads/201303/03/1362291330_3408.jpg)
1 我在做web的时候发现,有时候递交一个aciton的时候,会有很多的变化,比如所sign!main.action?id=4562&pd=mm
当我递交这个请求以后会出现很多的%
Character Encoding
" " (space) %20
"!" (exclamation point) %21
"$" (dollar sign) %24
"%" (percent sign) %25
"(" (left parenthesis) %28
")" (right parenthesis) %29
"*" (asterisk) %2a
" " (space) %20
"!" (exclamation point) %21
"$" (dollar sign) %24
"%" (percent sign) %25
"(" (left parenthesis) %28
")" (right parenthesis) %29
"*" (asterisk) %2a
2 scanf无法面对输入一行字符串的问题,因为如果输入遇到空格会停止
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<string>
using namespace std;
char input;
int main()
{
//freopen("in.txt","r",stdin);
while(scanf("%c",&input))
{
//文件输入完毕
if(input=='#')
{
return 0;
}
switch(input)
{
case ' ':
cout<<"%20";break;
case '!':
cout<<"%21";break;
case '$':
cout<<"%24";break;
case '%':
cout<<"%25";break;
case '(':
cout<<"%28";break;
case ')':
cout<<"%29";break;
case '*':
cout<<"%2a";break;
case '\n':
cout<<endl;break;
default:
cout<<input;
}
}
}