Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This assignment will give you practice with functions and vectors. I have given you a starter file called hurricane.cpp . You are free to create
This assignment will give you practice with functions and vectors. I have given you a starter file called hurricane.cpp You are free to create your solution from scratch. Create a program that will read data from a file called hurricanes.txt The data will consist of a citys name, wind velocity and amount of rain for the hurricanes that occurred in the United States. The input process will be terminated by the EOF marker. Some cities will have a space in the name. use the indata.ignore statement where needed Have the main function call a function to input the data from the file hurricanes.txt and store the data in vectors, City, Wind, and Rain. The max number of elements is However, the input function will keep track of the number of cities and put that count in the variable numcities.
The Main Function should:
Declare all vectors and variables needed
Call the ReadData Function to read the data into the vectors
a Pass the arguments needed
b Open the file hurricanes.txt
c Use a while loop to read data into the vectors until EOF is reached
d close the file
Call the SelSort Function to sort all three vectors by city.
a Use the selection sort to sort all three vectors simultaneously using numcities.
Call the PrintVectors Function that prints the three vectors in tabular form with column headers
Call the ViolentWinds Function to print each city where the hurricane was violent. A Hurricane is violent if its windspeed is at least mph Display the citys name and windspeed with the header Violent Winds
Call the MajorFlood Function to print each city where the hurricane produced a flood. A flood occurs if its rainfall is at least inches. Display the citys name and rainfall windspeed with the header Major Floods
Call the WindiestCity Function to return the vector positionhipos of the city with the highest windspeed.
Call the AverWind Function to return the average wind velocity.
Call the AverRain Function to return the average rain fall.
Display the name of the city with the highest winds speed along with its windspeed.
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