QUOTE(curiose @ 1 Dec, 2007 - 07:27 PM)

hello .... i think that u r faceing a problem in the output in the switch case it self as u have explained...add ur output after each case...and by the way in switch case we dont use (') with numbers in the case but only with characters.....
Although characters do also represent numerical digits. In this case, if the user types in
7, and his program retrieves a character, the value which it will retrieve will be the character
'7' and not the number
7.
To the OP - One option would be to use the default case to check. the standard library comes equipped with a function called
isdigit which can tell whether or not a character is a numerical digit.
Try something like this -
CODE
switch (para)
{
case '.':
case '!':
case '?': smark++;
break;
case ',':
case ';':
case ':': imark++;
break;
case ' ': blank++;
break;
default :
if( isdigit(para) )
dig++;
}
Edit - in order to use
isdigit, you will need to add the line
#include <cctype> near the top of your program.
This post has been edited by Bench: 1 Dec, 2007 - 02:39 PM