NEED A PERFECT PAPER? PLACE YOUR FIRST ORDER AND SAVE 15% USING COUPON:

Programming

[ad_1]

This is a basic C Programming class, so please only basic code. The program needs to be written in the Ch11.c  file.
Before starting, carefully study sort_str(), stsrt(), s_gets(), mod_str(), and format(). You will use the code from all of these functions! The sort_str() function will call the other functions, although you could call mod_str() from s_gets().

Your end goal is to create a program that prints a class roll sheet in alphabetical order. The program prints out the roster like this…

HATFIELD, HEIDI
KAISER, RUSSELL
LIPSHUTZ, HOWARD
PENKERT, DAWN
WRIGHT, ELIZABETH

The user inputs the students’ first name and last names separately but within one loop. The loop should end when the user presses enter on the first name without entering any text. Upon completing entry of data, the output pictured above should display on stdout.

First step: Get all the files working from your sort_str.c file with the following changes: You should be able to enter up to 20 student first names. Also, change the input array to an appropriate size of 18 for the length of the first name. Use  a meaningful name for the storage of first names array. Change prompts as needed. The loop should exit when the user presses enter when inputing the first name without adding any text. Compile and make sure it works from main(). At this point, you should be able to enter and alphabetize a list of up to 20 first names! Alphabetizing the first name is just a test!!! In the end, you will alphabetize the whole name string.

Make changes to convert the first name to all upper case using a function from mod_str(). Compile and test.

Add another array and get input for last name INSIDE the loop for your first names. This last name array will also be an array of 20 elements but with room for up to 25 characters. Again, do not use another loop! Just add code to input the last name to the first loop. The program should now ask the user to input the student’s first name and then last name in that order for each individual. Then the program will loop to continue adding student names until the user presses enter on the student’s first name. Make sure the last name is converted to all caps. You do not need to alphabetize this array, but you may want to print it out to make sure everything is working just as a test.

Last step: Combine last and first into an third array. You need to add the comma, so you may want to use sprintf() for this one. There are other ways. This code is most easily added to the first loop. You just had the user enter first and last names. So the current value of the subscript used for these arrays can be used to combine content and store in the third array.  Alphabetize THIS array (instead of the first name array)  which means you need to send a different pointer to the stsrt() function.  Print out the end result. Test that everything is working on this program.

[ad_2]

Source link

Looking for this or a Similar Assignment? Click below to Place your Order