I have a question to ask about reading details from text files.
In my text files, I have these information:
Employee Name: XXXXXX Address: XXXXXXXXXX Phone Number: XXXXXX Employee Name: XXXXXXXX Address: XXXXXXXX Phone Number: XXXXXX How can I get everything there is, in the correct format, to be output-ed into the console?
My code is:
ifstream inEmpFile; inEmpFile.open("emp.txt"); string file_contents; while(inEmpFile >> file_contents) { cout << file_contents << ' '; } inEmpFile.close(); inEmpFile.clear(); All I get is a chunk of text, yes the content is correct, but everything is joined together as in not in the correct format. How can I do it? Thanks in advance