Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In C++ Please! 39 The names.txt text file contains a number on the first line, n, followed by n lines with three names on each
In C++ Please!
39 The names.txt text file contains a number on the first line, n, followed by n lines with three names on each line as shown below: 4 Linda Adam Jo Bob Mina Clive Timothy John Maria Emily Augustine Xavier Write a program to do the following: Open the file Read the number on the first line into variable n If n is 0 or negative display an error message of your choice. If n is 1 or above do the following: o Read three names from the file into three variables o Determine the shortest name (assume the names on the same line have different lengths) o Display this name o Repeat this process for all remaining lines Close the input file. Expected output for the above example: Jo Bob John EmilyStep 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