#include <stdio.h>
#define MAXS 15
void StringCount( char s[] );
void ReadString( char s[] ); /* 由裁判实现,略去不表 */
int main()
{
char s[MAXS];
ReadString(s);
StringCount(s);
return 0;
}
/* Your function will be put here /
void StringCount(char s) {
int num = 0, uletter = 0, lletter = 0, blank = 0, other = 0;
for (; *s != '\0'; s++) {
if ((*s >= '0') && (*s <= '9')) {
num++;
}
else if ((*s >= 'a') && (*s <= 'z')) {
lletter++;
}
else if ((*s >= 'A') && (*s <= 'Z')) {
uletter++;
}
else if (*s == ' ') {
blank++;
}
else {
other++;
}
}
printf("% % % % %", uletter, lletter, blank, num, other);
}
(我运行不了,是哪里有问题,应该怎么更改)