杭电1048
此题是一道简单的程序应用题!!也没有太多好说的,哈!!!直接ac!!
**关于函数memset()的讲解请参考:http://www.cnblogs.com/xiohao/archive/2012/11/03/2752225.html
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
char a[205],b[205];
int i;
while(gets(a))
{
if(strcmp(a,"START")==0)
{ memset(a,0,sizeof(a));
memset(b,0,sizeof(b));}
if(strcmp(a,"ENDOFINPUT")==0)
break;
if(strcmp(a,"END")==0)
printf("%s\n",b);
for(i=0;a[i]!='\0';i++)
{
if(a[i]<='Z'&&a[i]>='F')
b[i]=a[i]-5;
else
if(a[i]>='A'&&a[i]<'F')
b[i]=a[i]+21;
else
b[i]=a[i];
}
}
return 0;
}
联系方式