The objective of this Programming Project is for students to write a C Program and to apply their knowledge of working with Pointers with two-dimensional arrays and passing the same through Pass by Reference Functions in C programming language.
Write a C program that would let users to input names in any order. The program then displays the names, sorted in Alphabetical order.
Your Program should include following key points:
1. Program must have header comments stating the author of the Program, date, and Program Description.
2. Prompt the user to enter the number of names in the list to be sorted, before accepting the names from the user.
3. You may use any sorting algorithm (learnt in previous courses, like Bubble Sort, Selection Sort, Insertion Sort, etc.) for sorting the names.
4. The program should include 2 Pass By Reference (Call by Reference) Functions:
void sortNames(char **, int*);
int compareStrings(char*, char*);
5. You nay use other standard functions available in string.h (except strcmp()), like strlen(), strcpy(), etc.
6. The program should run continuously in a loop till the user wishes to exit.
Sample output / Program run is given here:
How many names in the list?
10
Enter name 1 : Rip Van Winkle
Enter name 2 : Don Quixote
Enter name 3 : Hercule Poirot
Enter name 4 : Agatha Christie
Enter name 5 : Jane Eyre
Enter name 6 : William Wordsworth
Enter name 7 : Charles Dickens
Enter name 8 : Ada Lovelace
Enter name 9 : Charles Darwin
Enter name 10 : Jane Fonda
The sorted names list is:
Ada Lovelace
Agatha Christie
Charles Darwin
Charles Dickens
Don Quixote
Hercule Poirot
Jane Eyre
Jane Fonda
Rip Van Winkle
William Wordsworth