Question
A teacher has asked all her students to line up according to their first name. For example, in one class Amy will be at the
A teacher has asked all her students to line up according to their first name. For example, in one class Amy will be at the front of the line and Yolanda will be at the end. Using C++, Write a program that allows the user to choose whether they want to enter the names manually, or if the application should get the student names from a .txt file.
If they choose manually, the program should prompt the user to enter a number between 1 and 20 for the number of students in the class and then loop to read in that many names. Once all the names have been read in, it should report which student should be at the front of the line and which one would be at the end of the line.
If they choose to get the names from a .txt file, the names should be read in from the file until there is no more data to read in. The program should display all of the names from the .txt file before displaying which student should be at the front of the line and which one would be at the end of the line.
The program shouldn't use an array.
Names for the .txt file:
Liam
Olivia
Noah
Emma
Oliver
Charlotte
Elijah
Amelia
James
Ava
William
Sophia
Benjamin
Isabella
Lucas
Mia
Henry
Evelyn
Theodore
Harper
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