Hi everybody, my name is Candi and I am new here, I was lucky enough to find this forum.
I am new to C++ and am teaching myself because I can't afford school at this time, all I can afford is second hand books :( and I am having a serious problems with this question, and was wondering if any of you could please assist me in writing this and understanding this code pretty please :?:

Just so there is no confusion I am attempting to teach myself C++ through secondhand books, and tutorials, the question I ask comes from a book I have begone to read and thought I was doing rather well, the question stopped me dead in my tracks.
I do not go to school because I can't afford it, due to the recession where I live. I hope hope someone can help me please, I am determined to learn on my own. Can anyone suggest good books e-books and video tutorials as well for a beginner?

Here is my problem maybe someone can help me?

The problem is that I want to write an interactive program in C++ whose input is a series of 6 temperatures from the user of the program. It should write out on file tempdata.dat each temperature as well as the difference between the current temperature and the one preceding it. 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 the user via cout.

For example 34.5 38.6 42.4 46.8 51.3 63.1

The file tempdata.dat would contain
34.5
38.6 4.1
42.4 3.8
46.4 4.4
46.8 4.4
51.3 4.5

Using proper formatting and comments in the code.

Thanks everyone,
Candi~

So start with a simpler problem.

Like
- read in a temperature, then write out a temperature.

When that works, it might be easier for you to see what you need to do to tackle the next step (calculating the difference).

Building a program is like building with blocks. Start small then assemble the small parts into the larger whole.

Figure out how to do file reads/writes, then figure out how to compare values, then put the 2 together.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.