第三章6
#include<stdio.h> int main(void) { int dight,letter,other; char ch; int i; dight=letter=other=0; printf("Enter 10 characters:"); for(i=1;i<=10;i++){ ch=getchar(); if((ch>='a'&&ch<='z')||(ch>='A'&&ch<='Z')) letter++; else if(ch>='0'&&ch<='9') dight++; else other++; } printf("letter=%d,dight=%d,other=%d",letter,dight,other); return 0; }