printReverse names

Working on a project and I need to print names from an file in reverse order from Brown, James to James Brown. I have an idea on setting a void printReverese function just don't know what variables to use. Here is the file txt.

New Jersey
1 Andrews,Robert D 2265 RHOB
2 LoBiondo,Frank R 2427 RHOB
3 Runyan,Jon R 1239 LHOB
4 Smith,Chris R 2373 RHOB
5 Garrett,Scott R 2232 RHOB
6 Pallone,Frank D 237 CHOB
7 Lance,Leonard R 133 CHOB
8 Sires,Albio D 2342 RHOB
9 Pascrell,Bill D 2370 RHOB
10 Payne,Donald D 103 CHOB
11 Frelinghuysen,Rodney R 2306 RHOB
12 Holt,Rush D 1214 LHOB
Apart from the first line, the data seems to be:
int      1
string   Andrews,Robert
char     D
int      2265
string   RHOB

After reading the data, the string containing the person's name can be split into substrings by first finding the position of the comma, then assigning each substring to a new string
Topic archived. No new replies allowed.