主题:请教高手!!!
想请教这个程序的流程图要怎么画?
#include <stdio.h>
#define NO 0
#define YES 1
main()
{
int nc = 0; /* represents char count */
int nw = 0; /* represents word count */
int bs = 0; /* represents blank space count */
int nq = 0; /* represents numerical quantities */
int nl = 0; /* represents line count */
int inword = NO; /* inside word flag */
int c;
/* announce program */
printf("Text Analysis\n\n");
/* read characters and compute statistics */
while ((c = getchar()) != EOF) {
if(( c>= 'a' && c <= 'z') || ( c>= 'A' && c <= 'Z' )) /* write the code for counting characters here */
{
nc++;
if (inword == YES)
{
nw++;
inword = NO;
} /* write the code for counting words here */
}
else if( c>= '0' && c <= '9') /* write the code for counting numerical quantities here */
{
nq++;
inword = NO;
}
else if ( c == ' ' ) /* write the code for counting blank spaces here */
{
bs++;
inword = YES;
}
else if ( c == '\n' )/* write the code for counting the number of lines here */
{
nl++;
inword = YES;
}
else
break;
} /* This bracket is for the end of the while loop */
/* print the entire statistics */
printf("\t Text File Statistics is as follows:\n\n");
printf("The number of characters counted : %d\n", nc); /* print the number of characters */
printf("The number of numerical quantities counted : %d\n", nq); /* print the number of numerical quantities */
printf("The number of blank space counted : %d\n", bs); /* print the number of blank spaces */
printf("The number of words counted : %d\n", nw); /* print the number of words */
printf("The number of lines counted : %d\n", nl); /* print the number of lines */
}
#include <stdio.h>
#define NO 0
#define YES 1
main()
{
int nc = 0; /* represents char count */
int nw = 0; /* represents word count */
int bs = 0; /* represents blank space count */
int nq = 0; /* represents numerical quantities */
int nl = 0; /* represents line count */
int inword = NO; /* inside word flag */
int c;
/* announce program */
printf("Text Analysis\n\n");
/* read characters and compute statistics */
while ((c = getchar()) != EOF) {
if(( c>= 'a' && c <= 'z') || ( c>= 'A' && c <= 'Z' )) /* write the code for counting characters here */
{
nc++;
if (inword == YES)
{
nw++;
inword = NO;
} /* write the code for counting words here */
}
else if( c>= '0' && c <= '9') /* write the code for counting numerical quantities here */
{
nq++;
inword = NO;
}
else if ( c == ' ' ) /* write the code for counting blank spaces here */
{
bs++;
inword = YES;
}
else if ( c == '\n' )/* write the code for counting the number of lines here */
{
nl++;
inword = YES;
}
else
break;
} /* This bracket is for the end of the while loop */
/* print the entire statistics */
printf("\t Text File Statistics is as follows:\n\n");
printf("The number of characters counted : %d\n", nc); /* print the number of characters */
printf("The number of numerical quantities counted : %d\n", nq); /* print the number of numerical quantities */
printf("The number of blank space counted : %d\n", bs); /* print the number of blank spaces */
printf("The number of words counted : %d\n", nw); /* print the number of words */
printf("The number of lines counted : %d\n", nl); /* print the number of lines */
}