I have two files, and I am supposed to input both of them into arrays. One of them is:
2
3
4
5
7
8
The second one is
2
4
5
6
7
8
2
3
4
5
7
8
(it's much longer, but it doesn't matter). I need to have one array with the first 6 numbers, and then I am supposed to check if first six numbers from the second file are the same as the numbers in the second array, same with the next six numbers and so on (like checking for a lottery winner). I guess that I am supposed to load numbers from one file into multiple arrays, but I have no idea how to do it, and I can't find it anywhere.
The code for the first array that I have so far is:
#include<iostream>
#include<fstream>
using namespace std;
int main(){
int numbers[6];
int count = 0;
ifstream inputFile;
inputFile.open("Numbers.txt");
while (count < 20 && inputFile >> numbers[6]){
count++;
inputFile.close();
for (count=0; count < 20; count++)
cout << numbers[count];}
return 0;
}
Another problem is that instead of displaying the numbers correctly, it displays "-858993460" 6 times - even though my code is basically copied from a book...
What is wrong with my code, and how do I input the second file?