Write a program, which will ask the user how many names (one word, no spaces) th
ID: 3654002 • Letter: W
Question
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).Explanation / Answer
To really do this is C++, it would seem more appropriate to use C++ data structures like a Vector of Strings (rather than a 2-d array of chars). Oh well. Here's a simple example: #include #include #include #define NAMELEN 16 char nameStrings[20][NAMELEN]; char *names[20]; void readNames(int n) { for (int i=0; iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.