file problem

Hello i have a problem in reading more than one character from a file it reads just one character only

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<iostream>
#include<fstream>
using namespace std;
int main ()
{
	ifstream infile;
	infile.open("letters.txt");
	int x;
	char y;
	int Capital=0;
	int Small=0;
	cout<<"Please Enter A Choice "<<endl;
	cout<<"1:Capital & Small\n"
		<<"2:Vowels & Constants\n"
		<<"3:exit\n"<<endl;
	cin>>x;

	switch(x){
	case 1:{
		while(infile){
		
			char y=infile.get();
			if((y>='A')&&(y<='Z'))
				Capital++;
			else if((y>='a')&&(y<='z'))
				Small++;
			infile.get();}
		
		cout<<Capital<<endl;
		cout<<Small<<endl;
		   }break;
	}
		
		

	

	system("pause");
	return 0;
}


Topic archived. No new replies allowed.