I created a text file love.txt:
love.txt
i love you you love me
How do I store them into separate array, namely line1 and
line1
Try specifying the last argument as '\n' in both getline() functions:
getline()
getline(myfile, line1[a], '\n');
instead of
getline(myfile, line1[a], ' ');