hello,
I am reading in a file and storing it into an array,
and i am trying to find which letter appears most frequently in the array.
how can this be accomplished?
this is what i have so far. oh ya, and the file has spaces , but when i read contents of array there are no spaces.
Code:#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
using namespace std;
int main()
{
string line; // also tried char line[200];
int count = 0;
char reply;
ifstream infile;
string myfile;
ifstream inputFile;
inputFile.open ("encrypted.txt");
if(!inputFile)
{
cerr << "Can't open input file " << myfile << endl;
cout << "Press enter to continue...";
exit(1);
}
while (inputFile.peek() != EOF) {
inputFile >> line;
cout << line;
}
cin >> reply;
return 0;
}