Hello all,
I am attempting to write a program that will read in, from a file, an unknown number of 4 digit integers into an array (not more than 150 numbers). From there I will be performing various calculations on those numbers.
Listed below is what I have for reading in and displaying the file as a string. Any suggestions on what I should do to read in and initialize file as an array?
ifstream infile ("a:\\crypnums.txt");
int main()
{
time_t t;
time(&t);
yl;
cls;
string numbers, num;
while (! infile)
{
cout << "Error opening file " << endl;
exit(1);
}
while (getline (infile, numbers))
{
string num = numbers;
cout << num << endl;
}
frz;
return 0;
} // end of main function