标签:++ http char tchar lse printf 字母 while print
1 #include<stdio.h> 2 3 int main(void) 4 { 5 char a[80]; 6 int i; 7 8 i = 0; 9 while ((a[i] = getchar()) != ‘\n‘) 10 { 11 i++; 12 } 13 a[i] = ‘\0‘; 14 15 int sum = 0; 16 for (int j = 0; a[j] != ‘\0‘; j++) 17 { 18 if (a[j] >= ‘B‘ && a[j] <= ‘D‘) 19 { 20 sum++; 21 } 22 else if (a[j] >= ‘F‘ && a[j] <= ‘H‘) 23 { 24 sum++; 25 } 26 else if (a[j] >= ‘J‘ && a[j] <= ‘N‘) 27 { 28 sum++; 29 } 30 else if (a[j] >= ‘P‘ && a[j] <= ‘T‘) 31 { 32 sum++; 33 } 34 else if (a[j] >= ‘V‘ && a[j] <= ‘Z‘) 35 { 36 sum++; 37 } 38 } 39 40 printf("%d\n", sum); 41 42 return 0; 43 }
标签:++ http char tchar lse printf 字母 while print
原文地址:https://www.cnblogs.com/2018jason/p/12009422.html