I am new to this. I am trying to create a c++ program that can read in numbers from a file.
my file looks like this.
3 4 5 6 0
4 5 9 8 1
I am suppose to input each line of numbers into two seperate arrays of size 30.Any other array space that is not filled up, i am suppose to put in a zero.
so one of my array will include {3,4,5,6,0,0,0,0...} etc. Same with the other array.
can anyone please help?
void produceNum (int x[30], int y[30])
{
char ch = 'a';
int i = 0;
ifstream ins;
ins.open(in_file);
while (ch != '\n')
{
ins >> x[i];
ins.get(ch);
i++;
}
while (ch !='\n')
{
ins >> y[i];
ins.get(ch);
i++;
}
ins.close();