i have a text file as follows;
james
nnnnnnnnn mmmmm
kristy
llllllllllllllllll oooooooo
james
pppppppp ppppppppppp
james
iiiiiii kkkkkkkkkkkk
now for the out put, i want it as follows ;;;;;;;
james
nnnnnnnnn mmmmm
pppppppp ppppppppppp
iiiiiii kkkkkkkkkkkk
kristy
llllllllllllllllll oooooooo
the code i wrote for this is as;;;;
void File()
{
string fname[200];
string lname[200];
ifstream myfile;
myfile.open("names.txt");
if (!myfile)
{
cout << "File not found." << endl;
}
else
{
while (!myfile.eof() )
{
for(int i = 0; !myfile.eof(); i++)
{
getline(myfile, fname[i], '\n' );
getline(myfile, lname[i], '\n');
}
}
}
myfile.close();
what i want it to do is to, display the above text file as the expected out put i have provided.
but i am clueless of the code, can some one please help me with the code to get my expected output .. pleaseeeeeeeeeeee, i tried all, and now i am completely lost ... please help :(