Question: For this project you will write a program to: a)read-in the 10 first names from a file (the file is a priori known to have

For this project you will write a program to:

a)read-in the 10 first names from a file (the file is a priori known to have exactly 10 entries, of a maximum length of 8 letters each) into a two-dimensional character array

b) output the names to the terminal with each one preceded by a number indicating its original order in the list

c) sort the list of names

d) output the sorted names both to the terminal and to a file, again with each one preceded by its corresponding original order in the list.

The following minimum functionality and structure is required:

Ask the user for the input and output file names.

Read in the list of names from the desired input file.

Store the names list in a two-dimensional character array (Use character arrays (i.e., C-style) to hold your strings)

Print out the unsorted list of names to the terminal, preceded by their original order in the input file.

Sort the list of names by-length.

Print the list of sorted-by-length names to the terminal, preceded by their original order in the input file.

Write the list of sorted-by-length names to a different output file (e.g.SortedByLength.txt), preceded by their original order in the input file.

Sort the list of names alphabetically.

Print the list of alphabetically-sorted names to the terminal, preceded by their original order in the input file.

Write the list of alphabetically-sorted names to a different output file (e.g. SortedNames.txt), preceded by their original order in the input file.

Implement multiple functions. Make sure you use them.

The following are a list of restrictions:

No usage of external libraries for C-string manipulation is allowed (e.g. ), or any std::string libraries and data types.

No libraries except and are allowed.

No global variables or constants except: a) the fixed number of names, and b) the maximum C-string size.

No usage of pointers or dynamic memory.

You are expected to employ code abstraction and reuse by implementing and using functions. Copy-pasting code segments (that each performs a specific functionality which can be wrapped within a function) throughout your program will be penalized. Declare, Implement, and Use functions to achieve your objectives.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

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

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!