Program Description Write a C program that would let users to input names in any order. The program then displays the names, sorted in Alphabetical

Answered step by step
Verified Expert Solution
Question
65 users unlocked this solution today!

Program Description

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 Call By Reference Functions:
  • One function to sort the names.

Example signature of this function or function declaration:

void sortNames(char **, int*);

  • Another function that is called by the sortNames function, for comparing the names (similar to the standard strcmp() function of string.h). DO NOT use the standard strcmp() function of string.h. Simulate the functionality of standard strcmp() function with the help of pointers. (Hint: Similar to what was done in Lab5, but now done with Pointers.)

Example signature of this function or function declaration:

int compareStrings(char*, char*);

  1. You nay use other standard functions available in string.h (except strcmp()), like strlen(), strcpy(), etc.
  2. 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

Process returned 0 (0x0) execution time : 254.065 s

Press any key to continue.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Link Copied!

Step: 1

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

100% Satisfaction Guaranteed-or Get a Refund!

Step: 2Unlock detailed examples and clear explanations to master concepts

blur-text-image_2

Step: 3Unlock to practice, ask and learn with real-world examples

blur-text-image_3

See step-by-step solutions with expert insights and AI powered tools for academic success

  • tick Icon Access 30 Million+ textbook solutions.
  • tick Icon Ask unlimited questions from AI Tutors.
  • tick Icon Order free textbooks.
  • tick Icon 100% Satisfaction Guaranteed-or Get a Refund!

Claim Your Hoodie Now!

Recommended Textbook for

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

More Books
flashcard-anime

Study Smart with AI Flashcards

Access a vast library of flashcards, create your own, and experience a game-changing transformation in how you learn and retain knowledge

Explore Flashcards

Students Have Also Explored These Related Databases Questions!