I am trying to using two arrays, one to store name and another to store persons age. I have the arrays created and have been able to get the data in and display a table. However, I can't figure out how if I sort the age array, I can get the name array to follow suit. The name array is declared as a string and the age array is declared as an int. I am extremely new to C++ and programming in general and any assistance would be greatly appreciated.
I think it would be better if you use an object where you store a name and a person age belonging to that name together. Then you can sort those objects stored in an array. Each object keeps the person age and the corresponding name together, so there is no problem with sorting both at the same time.