编写一个程序,输入一个字符串,统计其中各个不同的字符出现的频度
例如:
直接上代码:
#include<stdio.h> #include<string.h> int main(){ char a[50];//定义一个字符数组 gets(a); int num[40]={0};//定义一个显示频度的数组 int j=0;//j在频度数组当中遍历 for(int i=0;i<=strlen(a);i++)//i在a中遍历 if(a[i]>='a'&&a[i]<='z')//首先判断数组a中的字符是不是字母 { for(int k=i+1;a[k]!='