I am trying to read the data (integers) from a file to a larger unsorted array and then move specific elements from that array to specific sub arrays. I can write the data from the file to the unsorted array fine but I get the wrong integers when trying to move the items to the sub arrays (lines 14 - 29). Is there a way to just write the specific integers directly from the file to the correct array instead of larger unsorted array? Example, if the number is between 0 and 9 then write it to array b1. Here is what I have so far.
//writes data from file to the array
while( (i < ARRAYSIZE) && (fin >> input_array[i]))
{
i++;
}
//close the input file
fin.close();
//this prints the array to screen so the user can visually verify it has the correct elements
for(int i =0; i < ARRAYSIZE; i++)
cout<<input_array[i]<<endl;
//places the elements from the input_array into the correct sub array depending on what range of integers it falls between
for(int i = 0; i < ARRAYSIZE; i++)
{
for(int j = 0; j < 4; j++)
{
if(input_array[i] < 10)
input_array[i] >> b1[j];
else if((input_array[i] >= 10) && (input_array[i] < 20))
input_array[i] >> b2[j];
else if((input_array[i] >= 20) && (input_array[i] < 30))
input_array[i] >> b3[j];
else if((input_array[i] >= 30) && (input_array[i] < 40))
input_array[i] >> b4[j];
else
cout <<"please check the data as element "<< i <<" will not fit in a sub array" <<endl;
}
}