Hello! I need to read 50 intergers from a text file and put them in an array.Then I have to seperate the numbers into different arrays to see if they are even or odd.
This is what I have and all I get as a cout is a place in memory like -862527. I cout because i just want to see if I even get to read the numbers at least but I'm doin it wrong.
Any help or tips would be welcomed!
#include "StdAfx.h"
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
using namespace std;
int main (){
ifstream infile;
int num=0;
int list[51];
int even [51];
int odd [51];
infile.open("infile.txt");
for (int i=0;i<51;i++)
{int x=0;
infile>>list[51];
cout<<list[51];
system ("pause");
}
system ("pause");
return 0;
}