Question: need help working on this C++ problem. we are barely learning about Structures, Streams & Vectors. 5 THE roundTrip PROBLEM Using the Star structure defined

need help working on this C++ problem. we are barely learning about Structures, Streams & Vectors.need help working on this C++ problem. we are barely learning about

5 THE roundTrip PROBLEM Using the Star structure defined in file p1.cpp, write the function named roundTrip(). The function takes one input parameter: a vector of Stars that represents a "travel itinerary". Visit every pair of stars in-order (0-1, 1-2, 2-3, etc.) and add up the distance between them. When you reach the last star, include in your sum the distance between it and the first. The function returns the round-trip distance as a double. The function also has one output parameter that returns the average magnitude of all of the stars visited. We'll assume that the stars are in 2D space and that you measure the distance using this formula You may write a function to do so. d= (x2-x1)24(y2-y1)2 double average; double distance = roundTripCvstars, average); Input parameter Output parameter 5 THE roundTrip PROBLEM Using the Star structure defined in file p1.cpp, write the function named roundTrip(). The function takes one input parameter: a vector of Stars that represents a "travel itinerary". Visit every pair of stars in-order (0-1, 1-2, 2-3, etc.) and add up the distance between them. When you reach the last star, include in your sum the distance between it and the first. The function returns the round-trip distance as a double. The function also has one output parameter that returns the average magnitude of all of the stars visited. We'll assume that the stars are in 2D space and that you measure the distance using this formula You may write a function to do so. d= (x2-x1)24(y2-y1)2 double average; double distance = roundTripCvstars, average); Input parameter Output parameter

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!