Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objective The objective of this Programming Project is for students to write a C Program and to apply their knowledge of working with Pointers with

Objective

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 Call by Reference Functions in C programming language.

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.

Example signature of this function or function declaration:

int compareStrings(char*, char*);

    1. You may 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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

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

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions