[Solved]Need Help C Please Program Read Following Input Standard Input E Std Cin First Line Input Q37144015
Need help with c++ please.
Your program will read the following input from thestandard input (i.e., from std::cin):
- The first line of the input describes a startinglocation, from which you’ll determine distances to otherlocations.
- The second line of the input specifies a positive numberof target locations to which you’ll determine distances fromthe starting location.
- Subsequent lines will describe each target location, withone target location specified on each line. You can safely assumethat the number of target locations described in the input willmatch the number specified on the second line.
- Locations are specified as a latitude, followed by aspace, followed by a longitude, followed by a space, followed bythe name of the location. The name of the location is all of thetext on the line that follows the space after thelongitude.
- Latitudes are specified as a non-negative decimal numberof degrees between 0 and 90, followed immediately by a slash,followed immediately by a direction (N for north or Sfor south). Note that the latitudes 0/N and 0/S areequivalent.
- Longitudes are specified as a non-negative decimal numberof degrees between 0 and 180, followed immediately by a slash,followed immediately by a direction (Wfor west or Efor east). Note that the longitudes 0/W and 0/E areequivalent, as are 180/W and 180/E.
It’s safe to assume that you’ll always be given input inthe format described above; you are not required to detecterroneous input and report errors, and it’s fine if you’re programhandles incorrect input in any way you’d like, up to and includingyour program crashing. We will only be testing your program withvalid inputs — though you should certainly assume that we’ll betesting it using inputs other than the example providedbelow.
Your program will determine which of the target locationsis closest to (i.e., the smallest number of miles away from) thestart location, as well as the which target location is farthestfrom (i.e., the largest number of miles away from) the startlocation.
After reading all of the input and determining the closestand farthest location, your program will write the following outputto the console (i.e., std::cout):
- The words Start Location, followed by a colon anda space, followed by the start location’s latitude, followed by aspace, folloewd by the start location’s longitude, followed by aspace, followed by the name of the start location inparentheses.
- The words Closest Location, followed by a colonand a space, followed by the closest location’s latitude, followedby a space, followed by the closest location’s longitude, followedby a space, followed by the name of the closest location inparentheses, followed by a space, followed by the distance from thestart location to the closest location in miles (surrounded byparentheses).
- The words Farthest Location, followed by a colonand space, followed by a description of the farthest location inthe same format as the closest one.
It’s not important to limit your output to a particularnumber of decimal places; feel free to output whatever C++ writesto the output by default, though you should note that latitudes,longitudes, and distances are intended to be numbers withfractional parts (i.e., they are not integers).
An example ofthe program’s execution
The following is an example of the program’s execution, asit should appear in the shell. Boldfaced, italicized text indicatesinput, while normal text indicates ouptut.
Notice, again, that there are no prompts or other output,other than the output that is required as specified above. This mayseem strange, but it’s safe to assume that this program is notultimately intended to have a human user; we’ll be runningautomated tests against it, so welcome prompts, etc., will get inthe way of us determining whether your program is correct, and willcause your program to fail every one of ourtests.
Also, you may get output that differs in the number ofdigits after decimal places; in general, that’s fine, so long asall of your output is within 0.1% of what we expect in every case(which is more than enough of a buffer to account for inaccuraciesintroduced by the use of floating-point types like float ordouble).
(And, for what it’s worth, the output above is correct; ifyou’re getting significantly different answers, particularly forthe distances between airports, it means that your formulas or yourimplementation are incorrect.)
Expert Answer
Answer to Need help with c++ please.Your program will read the following input from the standard input (i.e., from std::cin):The f… . . .
OR

