# include <conio.h>
# include <stdio.h>
# define N 1000
void fun(char *tt,int alf[])
{
int i;
char *p=tt;
for(i=0;i<26;i++)
alf[i] ;
while (*p)
{
if(*p>='A'&&*p<='Z')
alf[*p-'A']++;
if(*p>='a'&&*p<='z')
alf[*p-'a']++;
p++ ;
}
}
main()
{
char str[N];
char a='a';
int alf[26], k ;
clrscr() ;
printf("\nPlease enter a char string:");
scanf("%s",str);
printf("\n*******The original string******\n");
puts(str);
fun(str,alf);
printf("\n*******The number of
letter******\n");
for(k=0;k<26 ; k++)
{
if(k%5==0)
printf("\n");
printf("%c= %d ",a+k,alf[k]);
}
printf("\n");
}
# include <conio.h>
# include <stdio.h>
# define N 1000
void fun(char *tt,int alf[])
{
int i;
char *p=tt;
for(i=0;i<26;i++)
alf[i] ;
while (*p)
{
if(*p>='A'&&*p<='Z')
*p+=32;
if(*p>='a'&&*p<='z')
alf[*p-'a']++;
p++ ;
}
}
main()
{
char str[N];
char a='a';
int alf[26], k ;
clrscr() ;
printf("\nPlease enter a char string:");
scanf("%s",str);
printf("\n*******The original string******\n");
puts(str);
fun(str,alf);
printf("\n*******The number of
letter******\n");
for(k=0;k<26 ; k++)
{
if(k%5==0)
printf("\n");
printf("%c= %d ",a+k,alf[k]);
}
printf("\n");
}
输出的结果是对的,但是二级的考试系统就是给你错了,这是怎么回事啊??