tags:

views:

74

answers:

1

write a program to take entry of 'essay' from the user. this essay will contain all special charasters and quotation marks and all other characters. wap to calculate total number of words , total number of sentences and total number of paragraphs. also calculate total number of special characters?

+10  A: 

I can't believe you would expect someone to write a program for you, so I am assuming that you are asking the correct way to tackle the problem.

Break the problem down into smaller, manageable problems:

1) Define what a word is (a string of uninterrupted letters)

2) Work out a way of counting those items (e.g. you could start at the beginning of the input, look for how many interruptions to strings of letters there are)

3) Define what a sentence is (a string of words, ended by a period '.')

4) Work out a way of counting those items (e.g. you could count the number of periods preceeded by at least one word)

And so on.

Kieren Johnstone
Very nice answer, instead of just writing "this is a homework, do it yourself" or voting negative.
o15a3d4l11s2