Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Create nameSorter-algorithm.txt using the algorithm-template.txt to read name

ID: 3666089 • Letter: 1

Question

1. Create nameSorter-algorithm.txt using the algorithm-template.txt to read names in a text file, sort them alphabetically, and output them to the screen with these specifications:

A. The names are to be stored in an input text file, one name per line.

B. Prompt the user to enter the filename via the console keyboard.

C. Skip any blank lines that may be in the input file.

D. Skip any exact duplicates that may be in the input file.

E. Allow up to 25 names. Stop reading the file after the end-of-file is reached, or the 25th name is added and the list reaches its capacity.

F. Sort the list alphabetically, from A to Z, according to the first letter in the name string. The sorting and checking for duplicates should both be case-independent. But do not permanently convert the name case -- compare lowercase (or uppercase) versions of the text for sorting purposes only.

G. Ask the user what name to search for. If the name is not on the list, then add it to the file. Sort the list and output all the names.

2. Write nameSorter.cpp from nameSorter-algorithm.txt using programTemplateProto.cpp

Example partial output: Enter the name of the file containing names: myFriends.txt

Alex

beth

Carl

Pat

Sasha

Explanation / Answer

#include #include #include #include #include using namespace std; int main(){ // String holding each name std::string; // Temp value string temp; // Empty vector holding all names from file vector names; // Read names from file myFriends.txt ifstream in("Desktop/myFriends.txt"); if(!in.is_open()) cout