Hi guys i am trying to write a program that counts the number of lowercase characters in an input file and display the two most used lowercase letters. My problem is I dont know how to get my program to count each lowercase character and save them into an array of size 26 using an if loop, but im having trouble getting it to work.
#include <iostream>
#include<fstream>
#include <cstdlib>
using namespace std;
int main()
{
const int FIRST_LOWERCASE= 97;
const int LAST_LOWERCASE= 122;
const int SIZE= (LAST_LOWERCASE-FIRST_LOWERCASE);
char letter;
int array[SIZE];
string str;
ifstream inputFile("INPUT.txt"); // Opening input file
if(!inputFile){
cout<< "ERROR... the file INPUT.txt could not open.\n";
exit(1);
}
while(getline(inputFile,str)){// Reading from file and displaying characters
inputFile >> str;
cout << str; // Displaying to check will be deleted later on
}
if(letter<=FIRST_LOWERCASE&& letter>= LAST_LOWERCASE){// if loop to check for case of character
}
inputFile.close();// Closing file
}
Thanks in advance for your help.