Hello, so I'm a student in college and I'm new with C++ and I'm trying to make this program that allows me to read in names from a file, first name then last name, in Cstrings. Then I have to change it so that the output is "lastname, firstname". There are 7 names but the program is supposed to work whether there are 7 names or 25 names.

The program also must sort all the names so that they are in alphabetical order, then print them to another file.

I am only allowed to use one array as well.

I've tried a couple different ways but no matter how I do it I just can't seem to get it to work. Anyone have any suggestions on the route I should take in order to get this done? For some reason this one is just perplexing me.... I'm probably just over thinking it but any assistance would be greatly appreciated.


10 Years
Discussion Span
Last Post by Salem

The first step would be to make sure you can just read the information in, then simply print it out again unmodified.

Then add your attempt at sorting the data.

Post what you tried, at the point you get stuck.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.