#include <iostream>
#include <stdio.h>
#include <ctype.h>
#include <string>
//注意c++中string库和c中的string.h库不同
using namespace std;
int main()
{
    while(1)
 {
  string str;
  getline(cin,str);
  if(str == string("ENDOFINPUT"))
  {
   return 0;
  }
  else if(str == string("START"))
  {
   char a;
   a = getchar();
   while(a!='\n')
   {
    //利用c中的<ctype.h>库判断一下输入的字符是否是字母
    if(!isalpha(a))
     putchar(a);
    else
    {
     switch(a)
     {
      default:
       //字符可以直接进行加减运算
       putchar(a-5);
       break;
      case 'A':
       putchar('V');
       break;
      case 'B':
       putchar('W');
       break;
      case 'C':
       putchar('X');
       break;
      case 'D':
       putchar('Y');
       break;
      case 'E':
       putchar('Z');
       break;      
     }
    }
    a = getchar();
   }
   //注意必须输出'\n',否则提交时会出现格式错误的提示
   putchar('\n');
  }
 }
 return 0;
}

相关文章:

  • 2021-04-04
  • 2021-08-19
  • 2021-05-05
  • 2021-11-13
  • 2021-07-31
  • 2021-04-27
  • 2021-04-26
  • 2021-07-12
猜你喜欢
  • 2021-09-16
  • 2021-07-04
  • 2021-06-19
  • 2021-12-10
  • 2022-01-10
  • 2021-12-14
相关资源
相似解决方案