Can't find the errors as mentioned by the compiler!

Here's the program:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include<fstream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>

void CountAVD()
{
   int Vowels=0, Alphabets=0, Digits=0; 
   ifstream fil;
   fil.open("Story.txt");
   char ch;
   while(!fil.eof())
   {
	   ch=fil.get();
	   if(ch=='a' || ch=='A' || ch=='e' || ch=='E' || ch=='i' || 
ch=='I' || ch=='o' || ch=='O' || ch=='u' || ch=='U')
	   {
		   Vowels++;
		   Alphabets++;
	   }
        else if(ch==0 || ch==1 || ch==2 || ch==3 || ch==4 || ch==6 || ch==7 || ch==8 || ch==9)
		   Digits++;
		else if(ch=='q' || ch=='Q' || ch=='w' || ch=='W' || ch=='r' || ch=='R' || ch=='t' ||
			    ch=='T' || ch=='y' ||ch=='Y' ||ch=='p' ||ch=='P' ||ch=='l' ||ch=='L' ||
				ch=='m' || ch=='M' ||ch=='n' ||ch=='N' ||ch=='k' ||ch=='K' ||ch=='g' ||
				ch=='G' ||ch=='d' || ch=='D' ||ch=='j' ||ch=='J' ||ch=='b' ||ch=='B' ||
				ch=='c' ||ch=='C' ||ch=='z' || ch=='Z' ||ch=='s' ||ch=='S' ||ch=='v' ||
				ch=='V' ||ch=='x' ||ch=='X' || ch=='f' || ch=='F' || ch=='h' || ch=='H')
		   Alphabets++;	
			
        cout<<"Number of Vowels are: "<<Vowels<<endl;
		cout<<"Number of Alphabets are: "<<Alphabets<<endl;
		cout<<"Number of Digits are: "<<Digits<<endl;
}



void main()
{
	   clrscr();
	   CountAVD();
	   getch();
}


The compiler gives the following errors:
Line 38: Declaration Syntax Error
Line 44: Declaration missing ;
Line 44: Compound Statement Missing }


But I checked and couldn't find these errors anywhere. Then why isn't the program running? Help please!
Last edited on
The } on line 34 marks the end of the loop. You need another one to mark the end of the function.
closed account (Dy7SLyTq)
and saying if ch==0...ch==9 isnt going to do what you think. its going to do it by ascii value ( http://www.asciitable.com/ ). instead i would do ch=='0'
Topic archived. No new replies allowed.