Answered step by step
Verified Expert Solution
Link Copied!

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!image text in transcribed

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 Emily

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

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

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Data Mining Concepts And Techniques

Authors: Jiawei Han, Micheline Kamber, Jian Pei

3rd Edition

0123814790, 9780123814791

More Books

Students also viewed these Databases questions

Question

Name 4 companies that have a close innovation business model.

Answered: 1 week ago