با سلام
به نظرم برنامه زیر هم جواب بده
#include <conio.h>
#include <iostream>
#include <iomanip>
using std::cout;
using std::cin;
void t(int a[],int c[],int);
int main()
{
int c[1000]={0};
int b[1000];
char f[1000];
int size=0;
cout<<"enter reshte : ";
cin>>f;
for (int q=0;f[q] != '\0';q++)
size++;
for(int w=0;w<size;w++)
b[w]=f[w];
t(b,c,size);
getch();
return 0;
}
void t(int a[],int c[],int size)
{
for(int j=0; j<size;j++)
c[a[j]]++;
for(int z=97;z<123;z++)
cout<<static_cast <char>(z)<<" "<<c[z]<<"\n";
}