The input file has 4 items but the program seems to be counting more items. I was trying to create a function that would count the items that were capitals within the text file.
#include<iostream>
#include<fstream>
using namespace std;
bool ckeckCap(char ch){
if((ch>='A')&&(ch<='Z')){
return true;
return false;
}
}
int main(){
ifstream inputFile;
char ch;
bool cap;
int capa=0;
int count=0;
inputFile.open("input.txt");
if(!inputFile.is_open()){
cout<<"Error opening...Aborting"<<endl;
return 0;
}
while(!inputFile.eof()){
inputFile>>ch;
cap=ckeckCap(ch);
if(cap==true)
capa=capa+1;
//inputFile>>ch;
}
cout<<capa;
return 0;
}