Hello
i tried to solve this but i cant , the program will read the content of text file named (letter.txt )and determine number of
capitals and number of smalls., the problem is that i cant make a loop to read all the characters of the string ! it just read the first letter
ifstream infile;
infile.open("letters.txt");
while(!infile.eof()) //The important part
{
infile>>ch;
if((b>=65)&&(b<=90)){
capital++;}
elseif((b>=97)&&(b<=122)){
small++;}}
}
The .eof() functions checks if the pointer in the file has reached the end of file or not. Once the pointer reaches the end of file, it returns true(1) which breaks the loop.
And infile>>ch; reads every character(even white spaces).