This program executes but i can not get it to count the letter, numbers, etc,. It does count the string length properly. Any help. Program has to be one main function, in which I got scolded last time.
Code:
printf("This program will request and store a string of characters\n");
printf("and then report how many of the selected characters are:\n");
printf(" Letters\n");
printf(" Numerals\n");
printf(" Punctuation\n");
printf(" Spaces\n");
printf(" or Other\n\n");
//Prompt user for the input string
char S[SIZE];
printf("On the line below, enter the string that should be analyzed:\n >");
gets (S);
SL = strlen(S);
for (P=0; P<SL; ++P)
{
if (isalpha (S[P]));
S[P]+=QL;
QL = QL+1;
if (isdigit (S[P]));
QD = QD + 1;
if (ispunct (S[P]));
QP = QP + 1;
if (isspace (S[P]));
QS = QS + 1;
QO = QO + 1;
}
printf("\nANALYSIS RESULTS:\n\n");
printf("String Length: %d\n", SL);
printf("Letters: %d\n", QL);
printf("Numerals: %d\n", QD);
printf("Punctuation: %d\n", QP);
printf("Spaces: %d\n", QS);
printf("Other: %d\n", QO);
return (0);