访客只能看到部份内容,免费 加入会员 或由脸书 Google 可以看到全部内容
int i, k, n=0, s[128], nLen [128]; for (i=0; i<128; i++) nLen[i] = 0; FILE * sample = fopen("C:\\Documents and Settings\\User\\桌面\\sample.txt", "r"); while ((i = fgetc(sample)) != EOF) /*计算各个英文字母出现次数(不分大小写)*/ { k = (char) i; if ( islower(i) != 0) count[i - 71] += 1; else if ( isupper(i) != 0) count[i - 65] += 1; else k = 0; if (k) s[n++] = k; if (k==' ') { s[n-1] = 0; nLen [strlen (s)]++; n=0; } } for (i=0;i<128;i++) printf ("%d : %d", i, nLen[i]);