Planets in the Solar System
From Programming In C
[edit]
Exercise 8.2
The Planets Data File link points to a data file which contains the name, distance from the sun, mass and radius of the nine planets in the solar system. Save this file on your U: drive via either
- Open the link, copy and paste this data into a Word or Notepad document called planets in the same directory as your source code. Save the file as ”Text only”, so that it will be called planets.txt.
- Right click on the link and choose the download file option
Write a program that opens the file planets.txt and reads these data into an array of structures. Add a function to the program to compute each planet's density. For each planet write its name, year length (in seconds) and density to a separate file called results.txt
