I need to write a program in C++ that reads numbers from a file and calculates
- The Ten most common Regular Number
- The Ten least common Regular Number
- Frequency of the regular lottery numbers
- Frequency of the powerball lottery numbers
I managed to find a way to open the file and display it in my program. I stored all the numbers inside the char c but I have to find a way to store the first 5 numbers in a vector or array to look for the least most common and least most regular numbers.
I don't know how to store the first five numbers from the whole list in one array or vector and how to store the fifth column of numbers to calculate them.
This is what I have so far.
using namespace std;
int main() {
ifstream MyFile("LotteryNumbers.txt");
char ch;
while(!MyFile.eof())
{
MyFile.get(ch);
cout << ch;
}
MyFile.close();
return 0;
}