Hey, I need some help with reading in data into 3 parallel arrays. 2 of the arrays are integers and the last one is a character string. I need to be able to read in all the data from the fileand store it into the arrays. The format of the input file is like this:
526334512 2665312 Jones, Julie Claire
264910093 2689022 Morgan, James Walter
587194309 5441234 Allen, Mary Ann
... ... ...
The code that I have so far(that does not work) is this:
Code:
#include <iostream.h>
#include <fstream.h>
#include <iomanip.h>
#include <ctype.h>
#include <stdlib.h>
//Global variables
ifstream infile;
ofstream outfile;
typedef char str[30];
int main()
{
int n[30],m[30];
str name[30];
infile.open("in599A.dat");
while(infile)
{
for(int i=0;i<22;i++)
{infile >> n[i] >> m[i];
cout << n[i] << endl << m[i] << endl;
infile >> name[i];
cout << name[i] << endl;
}
}
return 0;
}