加上第4题了:
[CODE]
#include "stdio.h"
#include "string.h"
main()
{
char str[25]="wo ai beijing tiananmen!";
int i=0;
int daxie=0,xiaoxie=0;
for(i=0;i<25;i++)
switch(str[i])
{
case 'w':str[i]='c';break;
case 'o':str[i]='p';break;
case 'z':str[i]='a';break;
}
printf("\nthe first answer is:%s",str);
str[0]=str[0]-32;
for(i=1;i<25;i++)
{
if(str[i]==' ')
{
str[i+1]=str[i+1]-32;
}
else
continue;
}
printf("\n\nthe second answer is:%s",str);
for(i=0;i<25;i++)
if(str[i]>=65&&str[i]<=90) daxie++;
else if(str[i]>=97&&str[i]<=122) xiaoxie++;
printf("\n\nthe third ansewe is:\ndaxie=%d\txiaoxie=%d",daxie,xiaoxie);
for(i=0;i<25;i++)
if(str[i]=='a') str[i]=str[i+1];
printf("\n\nthe fouth answer is:%s",str);
}
[/CODE]
第5题要加不少呢。我的妈呀。。。