Question
CS 52 Lab 4 Savitch has a good description of strings and vectors in chapter 8. In this lab we would fill a vector with
CS 52 Lab 4
Savitch has a good description of strings and vectors in chapter 8. In this lab we would fill a vector with first names (in all upper case), and print the as filled vector. Then using a function SortNames, this names vector is sorted in ascending alphabetical order. Finally sorted vector is printed as well. Apart from main function, this lab should have two more function, whose proto-types are given below. [These proto-types cannot be altered. You must use them as is].
Function 1
void FillNames(vector
Function 2
void SortNames(vector
Main Function
The function calls FillNames function, prints the as filled vector. Then it calls SortNames function and finally prints the vector that has names sorted in ascending order alphabetically.Please see output example from my program below. The output example is part of specifications that your program must meet. Thus, review it carefully:
Intended output example
Information:
EOF character in windows is Control +Z
and EOF character on Mac is Control + D :
-----------------------------------------------
Enter first name only in all caps (example: JOHN)
Enter EOF character to exit name entry: JOHN
-------------------------------------------------
Enter first name only in all caps (example: JOHN)
Enter EOF character to exit name entry: TIM
---------------------------------------------
Enter first name only in all caps (example: JOHN)
Enter EOF character to exit name entry: ZACK
---------------------------------------------
Enter first name only in all caps (example: JOHN)
Enter EOF character to exit name entry: BERTHA
---------------------------------------------
Enter first name only in all caps (example: JOHN)
Enter EOF character to exit name entry: LISA
---------------------------------------------
Enter first name only in all caps (example: JOHN)
Enter EOF character to exit name entry: ADAM
---------------------------------------------
Enter first name only in all caps (example: JOHN)
Enter EOF character to exit name entry: BOB
---------------------------------------------
Enter first name only in all caps (example: JOHN)
Enter EOF character to exit name entry: KORINE
---------------------------------------------
Enter first name only in all caps (example: JOHN)
Enter EOF character to exit name entry: JILL
---------------------------------------------
Enter first name only in all caps (example: JOHN)
Enter EOF character to exit name entry: WILLY
---------------------------------------------
Enter first name only in all caps (example: JOHN)
Enter EOF character to exit name entry: NILLY
---------------------------------------------
Enter first name only in all caps (example: JOHN)
Enter EOF character to exit name entry: GENIUS
---------------------------------------------
Enter first name only in all caps (example: JOHN)
Enter EOF character to exit name entry:
---------------------------------------------
The original names in the vector are:
JOHN TIM ZACK BERTHA LISA ADAM BOB KORINE JILL WILLY NILLY GENIUS
After sorting alphabetically in ascending order
the names in the vector are:
ADAM BERTHA BOB GENIUS JILL JOHN KORINE LISA NILLY TIM WILLY ZACK
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started