Hi,
I am newbie to c++.
I would like to en quire on how to calculate the number of same alphabet in a string that we enter?
For example if let say i have entered ABAAGAYHAUIJA
and it should return 6.
Here's my code.
#include <iostream>
#include<conio.h>
using namespace std;
void countAlpha(char[]);
int main()
{
const int first=1000;
char aa[first];
cout<<"Enter a string: ";
cin.getline(aa,first);
getch();
return 0;
}
void countAlpha(char len[])
{
int count = 0, m = 0;
while (len[m] != '\0')
{
if (len[m] == 'A')
count++;
m++;
}
return;
}
Thank you in advance.