how to write a code in c++ or visual studio to split 5 column data into 2 column data in .DAT file extension

I have data of 5 columns, a total of 399 values. I want to split 5 column data it 2 columns. I have to write a code to convert the format of 5 column data into 2 columns. But I didn’t do well. can anyone help/tell me how to write code in a visual studio using a loop, arrays, and read and write statements to convert the data into 2 columns?
I am attaching a screenshot of the data that needs to be converted. The total numbers of rows are 161 now. But after converting into 2 columns of data, the total number of rows should be increased. I understand what I need but I can’t put this in code well. Need Help.

Thanks in advance
data file

code draft

input.dat file contains (162 rows,5 columns)

Read more here: Source link