我对字符串的想法很少。你能告诉我如何找到多个字符串中字符的平均值吗?
#include<stdio.h>
#include<conio.h>
int main()
{
int count_char=0,i;
int sum,average;
char str1[80];
char str2[80];
char str3[80];
printf("Enter string 1 : ");
gets(str1);
printf("Enter string 2 : ");
gets(str2);
printf("Enter string 3 : ");
gets(str3);
for(i=0; str1[i]!=0; i++)
{
count_char++;
if(str1[i]==0)
i++;
}
printf("\nNumber of characters in string 1 : %d",count_char,str1);
getch();
count_char=0;
for(i=0; str2[i]!=0; i++)
{
count_char++;
if(str2[i]==0)
i++;
}
printf("\nNumber of characters in string 2 : %d",count_char,str2);
getch();
count_char=0;
for(i=0; str3[i]!=0; i++)
{
count_char++;
if(str2[i]==0)
i++;
}
printf("\nNumber of characters in string 3 : %d",count_char,str3);
getch();
return 0;
}
*我想找到我的代码的多个字符串的平均值。但我不能。你能帮帮我吗?我不明白该怎么做