Need help with sorting?

I have no clue how to even start. Can you tell me what I need to do? Like give me a list of things to do in order....

Note, I'm not asking you do write the code for me, just tell me what to do. Like write the function for x,then do this, etc.

"Write a program, which will ask the user how many names (one word, no spaces) they wish to enter. The program will then read that many names, store them in a two dimensional array of characters (one row per name), print them in the order they were entered, then sort them in increasing alphabetical order, and print them in sorted order. The sort will be done without regard to the case of the letters (i.e. case insensitive sort). The printing of each name MUST be done with the characters as they were typed, you cannot change the case.
The maximum number of names to be handled will be 20.
The maximum number of printable characters in a name is 15.
Use a two dimensional array to store the names.
Create a function to read in all the names.
Create a function to do the sort (modify the bubble sort discussed in class and in the text book)."

I really don't know why I took this class...
Can you do this bit?
Write a program, which will ask the user how many names (one word, no spaces) they wish to enter.
I think you should start from writing a swap function for character arrays. It will be used during sorting the two-dimensional array.
@Moschops, yea, that I can do.
Then you should write a function to compare two character arrays without regard to the case of the letters.:)
Last edited on
The program will then read that many names, store them in a two dimensional array of characters (one row per name)


Can you do that? Maybe you should just tell us the first bit you don't know how to do. You gave the impression that you don't even know how to write int main() but now it turns out that actually you can do some of this?

Help yourself, and help us help you; ask good questions.
@Moschaps. Ok, you are absolutely right. Well, asking user how many words they wish to enter is all I know.

Yes, I know, I'm a idiot, I should have dropped this class when I could have. I'm just to prideful to do that, I want to stick it out to the end and learn this crap, even though it has nothing to do with my major.
Well, asking user how many words they wish to enter is all I know.


1
2
3
cout << "How many words to enter?" << endl;
int numberOfWordsToEnter;
cin >> numberOfWordsToEnter;
Topic archived. No new replies allowed.