Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Challenge 2 7 Description The purpose of this challenge is load a tokenized file. This challenge loads a file of airport codes and allows the
Challenge
Description
The purpose of this challenge is load a tokenized file. This challenge loads a file of airport codes and allows the user to query its contents.
Requirements
Using vi create a text file, airports.txt that will contain the following data as shown below. You don't have to write code to create this file. Ask yourself, Why do the cities with multiple words use a dash instead of an actual space? LosAngeles instead of Los Angeles
BFL Bakersfield LAX LosAngeles GRV Grozny IAH Houston MGA Managua
LGA LaGuardia
AGU Aguascalientes BER Berlin JFK NewYork
In main, declare an array of strings cities
Using a
function int readairportsstring cities int threshold This function will read the airports.txt file. As you read the entire file, identify which airports have at least threshold terminals and store the corresponding city names into the cities array. This function will also return the number of cities found whose number of terminals is at least threshold. Do not cout in this function. Use the cities array to hold the qualifying city names. Use main to display the contents of the cities array, Ask yourself, why does this function return the number of qualifying cities?
Ask the user to enter an integer which represents the threshold number
Display the cities found. Make sure you display the qualifying cities from main Consider the possibility that the cities array may not be completely filled with names only display the names filled in by the readairports function.
Sample mainSample InteractionEnter a threshold number: The following airports have at least terminals:LosAngeles Houston Houston NewYork NewYork
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