Hi,This time Almost, I solved question.But I have problem with counting lines.I can't figure out how to count lines with isspace.
the code is
Code:
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main(void)
{
char ch;
int space = 0, upper = 0, lower = 0, punct = 0;
FILE *inp;
inp = fopen("text.dat", "r");
while(!feof(inp)){
fscanf(inp, "%c", &ch);
if (isspace(ch))
space++;
if (isupper(ch))
upper++;
if (islower(ch))
lower++;
if (ispunct(ch))
punct++;
}
printf("The %d of text processed contained %d capital letters,\
%d lowercase letters, and %d punctuation marks.", space, upper, lower,\
punct);
return(0);
}
text.data file>>
Even though she stands only 3 feet 9 inches tall, Judy Lohden has a big voice. And we're not just talking about her singing, which fills the school auditorium and wows audiences. What we love is her wry, funny narrative voice, which grabs readers and guides them through the intricate social hierarchies of cafeteria and classroom as only an outcast truly can. From the author of the hilarious memoir, Foreign Babes in Beijing, this is a novel that's filled with wit, yearning, and unforgettable character.
output
The 86 lines of text processed contained 9 capital letters,397 lowercase letters, and 14 punctuation marks.
The problem is,
it counting all whitespace, I just want to count newlines.
How can it be with using isspace...