I'm new to C++, so far have been doing good with my assignments. Now I have a problem understanding functions with arrays.
Homework is to read in names into two dimensional arrays, print them in order they were typed and then sort and print them in alphabetical order.
My program works perfectly as it is but I need to create two functions to read in the names and sort the names.I don't know how to do it with two dimensional arrays.
Here's what I have so far, I would appreciate any feedback. I'm not looking for quick fix, I want to learn to understand how to do this, if someone could just point out mistakes that i need to fix
Thanks!
this is the function to read in names:
void Get(char **A, int N )
{
int i;
const int MNames=20;
const int MChar=15;
Can you post your full code? Use the buttons on the right of the dialogue box to post it all proper-like.
Homework is to read in names into two dimensional arrays, print them in order they were typed and then sort and print them in alphabetical order.
I don't follow this. Homework is to read in names? Into arrays? Sounds like a user defined dynamic array, for which you can use the new and delete functions. Here is an example of a 1d array that resets with each use, and populates the array based on user input: