帮忙看看行数统计怎么不对呀
#include<stdio.h>#define MAXNUM 1000
int countchar(char []);
int countword(char []);
int countrow(char []);
int main()
{
char message[MAXNUM];
int numchar;
printf("请输入单词:");
gets(message);
numchar=countchar(message);
printf("输入单词的字符数是:%d\n",numchar);
numchar=countword(message);
printf("输入单词的个数是:%d\n",numchar);
numchar=countrow(message);
printf("输入单词的行数是:%d\n",numchar);
return 0;
}
int countchar(char list[])
{
int i,count=0;
for(i=0;list[i]!='\0';i++)
count++;
return(count);
}
int countword(char list[])
#define YES 1
#define NO 0
{
int i,inaword,count=0;
inaword=NO;
for(i=0;list[i]!='\0';i++)
{
if(list[i]==' ')
inaword=NO;
else if(inaword==NO)
{
inaword=YES;
count++;
}
}
return(count);
}
int countrow(char list[])
{
int i,count=0;
for(i=0;list[i]='\n';i++)
count++;
return(count);
}