Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions