你是计院大一的吗?
//Problem 3
#include
int main()
{
char c=getchar();
if(c>='a'&&c<='z' || c>='A'&&c<='Z')
{
printf("%c is a letter.\n",c);
if(c>='a'&&c<='z')
{
printf("%c is a lowercase.\n",c);
printf("The corresponding uppercase is %c.\n",c-32);
}
else printf("%c is an uppercase.\n",c);
}
else printf("%c is not a letter.\n",c);
return 0;
}
//Problem 4
#include
#include
int main()
{
char str[100];
int letters=0,numbers=0,bars=0,others=0;
int i;
gets(str);
for(i=0;i{
if(str[i]>='a'&&str[i]<='z' || str[i]>='A'&&str[i]<='Z') letters++;
else if(str[i]>='0'&&str[i]<='9') numbers++;
else if(str[i]==' '||str[i]=='\t') bars++;
else others++;
}
printf("There are %d letter(s), %d number(s), %d space(s) and %d other character(s) in this string.\n",letters,numbers,bars,others);
return 0;
}
//Problem 5
#include
#include
int main()
{
int i,offset;
char str[100];
printf("Please input the offset distance:");
scanf("%d",&offset);
fflush(stdin);
printf("Please input the original text:\n");
gets(str);
for(i=0;i{
if(str[i]>='a'&&str[i]<='z')
str[i]=(str[i]-'a'+offset%26)%26+'a';
else if(str[i]>='A'&&str[i]<='Z')
str[i]=(str[i]-'A'+offset%26)%26+'A';
}
printf("The encrypted text is:%s",str);
return 0;
}