Planets in the Solar System

From Programming In C

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

  1. 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.
  2. 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


Return to the course summary

phy225: Course Details

general


compilers


2011-12 assessments


past exam papers

  • 2008-9 (http://physics-database.group.shef.ac.uk/exampapers/2008-09/PHY225%20LT.pdf)
  • 2009-10 (http://physics-database.group.shef.ac.uk/exampapers/2009-10/PHY225%20Exam%20Sem%201%202009-10.pdf)
  • 2010-11 (http://physics-database.group.shef.ac.uk/exampapers/2010-11/PHY225_10_11.pdf)