整体运行没错,但是单步调试出错,大神帮我看看。
#include<stdio.h>#define x 70
#define y 70
int word=0;
int notword=0;
void inputarticle(char a[x][y])
{
int i, j;
for (i = 0; i < x; i++)
{
for (j = 0; j < y; j++)
{
scanf_s("%c", &a[i][j]);
if (a[i][j] == '#')
{
return;
}
}
}
}
void getword(char a[x][y])
{
int i, j;
for (i = 0; i < x; i++)
{
for(j=0;j<y;j++)
if (a[i][j] == ' ' || a[i][j] == '!' || a[i][j] == '?' || a[i][j] == ',' || a[i][j] == '.' || a[i][j] == ';' || a[i][j] == ':')
{
word++;
}
else if (a[i][j] == '#')
{
break;
}
}
}
void getnotword(char a[x][y])
{
int i, j;
for (i = 0; i < x; i++)
{
for (j = 0; j < y; j++)
if (a[i][j] == '!' || a[i][j] == '?' || a[i][j] == ',' || a[i][j] == '.' || a[i][j] == ';' || a[i][j] == ':')
{
notword++;
}
else if (a[i][j] == '#')
{
break;
}
}
}
void getarticle(char a[x][y])
{
int i, j;
for (i = 0; i < x; i++)
{
for (j = 0; j < y; j++)
{
if (a[i][j] == '.' || a[i][j] == '!' || a[i][j] == '?')
{
printf("%c\n", a[i][j]);
}
else if (a[i][j]!='#')
{
printf("%c", a[i][j]);
}
else if (a[i][j] == '#')
{
return;
}
}
}
}
int main()
{
char a[x][y];
inputarticle(a);
getword(a);
getnotword(a);
getarticle(a);
printf("单词个数为:%d", word);
printf("符号个数为:%d", notword);
getchar();
getchar();
return 0;
}
帮忙看看整体运行的时候正确,单步调试的时候就在第一个函数就出现错误了,我应该怎么输入一篇文章?