Home > Back-end >  The C language
The C language

Time:10-05

How to solve the problem of statistical number repeat English letters? C programming 0.0

CodePudding user response:

You need at least one array, to store the number of letters; Then need to traverse the document or string;

CodePudding user response:

I use an array of each corresponding English letters, and then input a string of characters in English, if you have repeated that array corresponding to one plus one, I won't solve now is how these 26 array statistics out of a specific number 26 instead of CMD output digital characters

CodePudding user response:

Int the stat [26]={0};
While (... ) {
Ch=... ;
If (ch & gt;='a' & amp; & Ch & lt;='z')
The stat [ch - 'a'] + +;
}

For (int I=0; i<26. I++)
Printf (" % c: % d ", I + 'a', stat [I]);
  • Related