I am trying to create a program that will count and display the number of vowels, consonants, spaces and full-stops within a 50 character limit. There is one error that the compiler keeps bringing up and when i try to fix it by changing the text it creates more errors - I am in a bit of a pickle.
The error reads; Text Analyzer Assignment.ccp(14.5):Statement missing ;
#include <stdio.h>
void main(void)
{
char text[50], *ptr;
int spaces=0, vowels=0, consonants=0, other=0;
printf("Enter text: ");
gets(text);
for (ptr=text; *ptr; ptr++)
{
if (*ptr == ' ') spaces++
//the error is in the line below//
[B]else if (*ptr == 'a' || *ptr == 'e' || *ptr == 'i' || *ptr == 'o' || *ptr == 'u' || *ptr == 'A' || *ptr == 'E' || *ptr == 'I' || *ptr == 'O' || *ptr == 'U') vowels++;[/B]
else if ((*ptr > 'a' && *ptr <= 'z') || (*ptr > 'A' && *ptr <= 'Z')) consonants++;
else other++;
}
printf("There were:\r\n");
printf(" %d vowel%s\r\n", vowels, vowels == 1 ? "" : "s");
printf(" %d consonant%s\r\n", consonants, consonants == 1 ? "" : "s");
printf(" %d space%s\r\n", spaces, spaces == 1 ? "" : "s");
printf(" %d other character%s\r\n", other, other == 1 ? "" : "s");
}
Any good advice would be very helpful: I know that this is basic stuff but it will help me out greatly.