Question: C++ console application that converts planet data. Download file PlanetsIn.txt to project folder project-name>I . Within your application, open file PlanetsIn.txt and scan past the

 C++ console application that converts planet data. Download file PlanetsIn.txt to
project folder project-name>I. Within your application, open file PlanetsIn.txt and scan past

C++ console application that converts planet data. Download file PlanetsIn.txt to project folder project-name>I. Within your application, open file PlanetsIn.txt and scan past the header line. Then, for each line read, echo the line, parse the line into three variables (planet, diameter, length). Use the following C++string function to parse the line into substrings . substr (, ) Use the following C++function to convert a substring to a real number (double) stod () You may combine the parse and convert operations into one. Here is an example: stod (line.substr (11, 15)) Convert the diameter from miles to kilometers (diameter 1.609344) and the length to earth days (length / 24). Print the planet, and the converted diameter and length. After all lines have been read from the input file, print the average diameters in miles and kilometers, and the average lengths in hours and days. Format any real numbers to one decimal place. The start of your output should look like this: Mercury 3032 879.5 7521 Input 1ine (miles, hours): utput 1ine (kiloneters,days): Mercury 4222.6 175.9 Input 1ine (miles, hours): utput line (kilometers, days): venus 2802.0 116.8 12103.9 The end of your output should look like this: utput 1ine (kiloneters, days): Pluto Input line average (niles, hours): 2389.9 6.4 22965.9 6960.0 726.3 30. 3 output Tine average (ki loneters, days): 11 line(s) read from file PlanetsIn.txt" ind of Planet Poachers

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!