Hello I need to read 50 intergers from a text file and put them into an array. and output or show the user the numbers.
for example: 23 73 58 49 34..... I need them to go into my array.
I tried this code but it just outputs -850993.
Heres my code :
int main ()
{
ifstream infile;
int num;
int list[50];
infile.open("infile.txt");
while (!infile.eof())
{
for(i=0;i<50<<i++)
infile>>list[num];i++;
cout<<list[num];
}
system ("pause");
return 0;
}