poj 3650 The Seven Percent Solution

来源:互联网 发布:windows 文件管理器 编辑:程序博客网 时间:2024/06/02 22:59
#include <iostream>#include <string>using namespace std;int main(){    string input, ans;    int i, len;    while (getline(cin, input))    {          if (input == "#")  break;          ans.clear();          len = input.length();          for (i = 0; i < len; i++)          {              if (input[i] == ' ')                 ans += "%20";              else if (input[i] == '!')                 ans += "%21";              else if (input[i] == '$')                 ans += "%24";              else if (input[i] == '%')                 ans += "%25";              else if (input[i] == '(')                 ans += "%28";              else if (input[i] == ')')                 ans += "%29";              else if (input[i] == '*')                 ans += "%2a";              else                  ans.push_back(input[i]);          }           cout << ans << endl;    }        system("pause");} 

原创粉丝点击