Home > Back-end >  Want to be a reference for the answer, I write can't run, thank you
Want to be a reference for the answer, I write can't run, thank you

Time:12-02

Compile a program to receive keyboard input of English articles, the default input number is 100 es characters, statistics of the number of occurrences of vowels, and output the number of occurrences of each vowel letters,

CodePudding user response:

Code to stick,

CodePudding user response:


Int main ()
{
Struct
{
Char the chKey;
Int nCount;
}
Vowels [5]=
{
'a', 0,
'e' 0,
'I' 0,
'o' 0,
'u' 0,
};

Char ch=EOF.
While ((ch=getchar ())!=(EOF)
{
for (int i=0; i <5; + + I)
{
If (ch==vowels [I] the chKey
| | ch==vowels [I] the chKey - 'a' + 'a')
{
+ + vowels [I] nCount;
}
}

Ch=EOF.
}

for (int i=0; i <5; + + I)
{
Printf (" '% c' : % d \ r \ n ", vowels [I] the chKey, vowels [I] nCount);
}

system("pause");

return 0;
}
  • Related