PDA

View Full Version : Write an interactive C++ program that reads a series of 12 temperatures from a file c


willwill
May 15, 2008, 11:52 AM
Write an interactive C++ program that reads a series of 12 temperatures from a file called "12temp.dat". It should display to the user each temperature and the difference between the current temperature and the one preceding it via cout. The difference is not output for the first temperature that is input. At the end of the program the average temperature should be displayed. For example given the following input data:

34.5 38.6 42.4 46.8 51.3 63.1 60.2 55.9 60.3 56.7 50.3 42.2

34.5
38.6 4.1
42.4 3.8
46.8 4.4
51.3 4.5
63.1 11.8
60.2 -2.9
55.9 -4.3
60.3 4.4
56.7 -3.6
50.3 -6.4
42.2 -8.1

The average temperature is: 50.2

Be sure to use proper formatting and appropriate comments in your code. Output should be labeled clearly and formatted neatly.

VB_2008
May 16, 2008, 01:51 PM
Here are some hints:
C++ Programming : Program 41-A (http://www.syvum.com/cgi/online/serve.cgi/squizzes/cpp/cpp_p41a.html)
C++ EXERCISES 3 (http://www.doc.ic.ac.uk/~wjk/C++Intro/RobMillerE3.html)
http://media.wiley.com/product_data/excerpt/23/07645685/0764568523-1.pdf
C++: Programming Problem - Temperature Opinion (http://www.fredosaurus.com/notes-cpp/functions/exercises/q-pr-func-temp-opinion.html)
http://fidelio.cacs.louisiana.edu/150/examples/This%20is%20My%20First%20C.pdf

If you want to finish off your assignments on time you've got to get working and try your best to find solutions for your programming problems... I have not used c++, but I know what it is like to start programming with no prior knoweldge of where to start...

The best of luck...