Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The program needs to sort last names and first names in alphabetical order from a file PROGRAM DONE IN THE C LANGUAGE Sort full names

The program needs to sort last names and first names in alphabetical order from a file

PROGRAM DONE IN THE C LANGUAGE

Sort full names based on last name, then sort based on first name if the last names are identical

tip: use two arrays of pointers to strings(arrays of char), one for the first names and one for the last names

When sorting, you just need to perform the swap on both lists

Take a command line argument as a filename, and get the list of names from that file.

Take a second command line arument as a filename, and write the sorted list of name to a file of that name.

Make the sorting case-insensitive, by creating & using your own version of the library function strcmp

BUT... when printing the names, you should keep the original capitalization.

Function name: strcmp_ci (stands for "string compare, case insensitive")parameters and return value work just like strcmp, except must be case-insensitivetips :instead of comparing names directly, copy them to temporary char arrays

convert letters in the temporary array to either rall uppercase or all lowercase

compare the the temporary arrays to decide whether two words need to be swapped

image text in transcribed

Program #1: GS . o Modify the sorting list of words example from class in the following ways " Instead of single words, read pairs of first/last name pairs Sort full names based on last name, then sort based on first name if the last names are identical tip use two arrays of pointers to strings(arrays of char) o one for the first names o one for the last names * when sorting, you just need to perform the swap on both lists " Take a command line argument as a filename, and get the list of names from that file " Take a second command line aumen as a filename, and write the sorted list of name to a file of that name " Make the sorting case-insensitive, by creating & using your own version of the library function strcmp o BUT... when printing the names, you should keep the original capitalization Function name: strcmp.ci (stands for "string compare, case insensitive") * parameters and return value work just like strcmp, except must be case-insensitive * tips O instead of comparing names directly, copy them to temporary char arrays convert letters in the temporary array to either call uppercase or all lowercase compare the the temporary arrays to decide whether two words need to be swapped Program #1: GS . o Modify the sorting list of words example from class in the following ways " Instead of single words, read pairs of first/last name pairs Sort full names based on last name, then sort based on first name if the last names are identical tip use two arrays of pointers to strings(arrays of char) o one for the first names o one for the last names * when sorting, you just need to perform the swap on both lists " Take a command line argument as a filename, and get the list of names from that file " Take a second command line aumen as a filename, and write the sorted list of name to a file of that name " Make the sorting case-insensitive, by creating & using your own version of the library function strcmp o BUT... when printing the names, you should keep the original capitalization Function name: strcmp.ci (stands for "string compare, case insensitive") * parameters and return value work just like strcmp, except must be case-insensitive * tips O instead of comparing names directly, copy them to temporary char arrays convert letters in the temporary array to either call uppercase or all lowercase compare the the temporary arrays to decide whether two words need to be swapped

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Probabilistic Databases

Authors: Dan Suciu, Dan Olteanu, Christopher Re, Christoph Koch

1st Edition

3031007514, 978-3031007514

More Books

Students also viewed these Databases questions