Knowledge point: the use of arrays, combined with loops
Getchar () Usage
Note: For array a [1000], there is no a = getchar () and then the characters are loaded into the array one by one. This is incorrect.
And scanf ("% s", a); is not correct.
Content: enter several characters (ending with '#') to calculate the number of times 'A' or 'A' appears in the entered characters.
Input description:
A row contains several characters.
Output description:
An integer that represents the number of occurrences of the or a character and.
Input example: abcdefabcdefaaaa #
Output example: 6
1 # include <stdio. h> 2 int main () 3 {4 char a [500]; 5 Int I, S = 0; 6 for (I = 0; I <500; I ++) 7 {8 A [I] = getchar (); 9 if (a [I] = 65 | A [I] = 97) 10 {11 S + = 1; 12} 13 if (a [I] = 35) 14 {15 break; 16} 17} 18 printf ("% d \ n", S); 19 Return 0; 20}