Answered step by step
Verified Expert Solution
Question
1 Approved Answer
c++ The data.txt text file contains a number on the first line, n, followed by n lines with three nan each line as shown below:
c++
The data.txt text file contains a number on the first line, n, followed by n lines with three nan each line as shown below: Linda Adam do Mina Bobelive John Xavier Dana Tim Emily Katie Write a program to do the following: Open the file Read the number on the first line into variablen If nis Oor negative o display an error message of your choice. Ifnis 1 or above do the following: 6 Read three names from the file into three variables Determine the name that would be first in alphabetical order (the smallest) Display this name Repeat this process for all remaining lines Close the input file Expected output for the above example, Adam Bob DO Emily 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