i am still not getting the drift

I am trying to get a grip of c++ before school starts in september and i am trying to understand it as much as i can. This question here below im am trying to figure out i dont even know where to start writing up this program

The heating system in a school should be switched on if the average temperature is less than 17 degrees celcius. The average temperature is found from the temperatures in the art english and music departments. You are required to write a C++ program that allows the user to input 3 temperatures. The program calculates and displays the average temperature and then displays "heating should be on " or " heating should be off" as appropriate.
When faced with a problem like this, you should break it down into discrete tasks. That description tells you some things the program must do:

- allows the user to input 3 temperatures
- calculate the average temperature
- display the average temperature
- work out whether the heating should be on or off
- display a message telling the user whether the heating should be on or off

Write code to do each of those tasks. Then put it all together.
I thought I gave the OP enough hints/links in his last thread:
http://www.cplusplus.com/forum/beginner/170043/

this is what i came up with

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

#include <iostream>
#include <cmath>
using namespace std;

int main()

{

int tempArt;
int tempEnglish;
int tempMusic;
double avg = (tempArt + tempEnglish + tempMusic) / 3.0;

do
{
        cout<<"Please enter Art Temperature and press Enter.";
        cin >> tempArt;
        

        cout << "Please enter English Temperature and press Enter.";
        cin >> tempEnglish;

        cout << "Please enter Music Temperature and press Enter.";
        cin >> tempMusic;



        if(avg <= 17)
        {
           cout << "heating should be on: " << avg << endl;
        }

        else if (avg >= 17)
        {
            cout << "heating should be off: " << avg<< endl;
        }

        cout << "Do you want to continue enter Y or N to stop: ";
        cin  >> yesno;
        yesno = toupper(yesno);

    }while (yesno == 'Y');


    // system ("pause");
    return 0;
}
1
2
3
4
int tempArt;
int tempEnglish;
int tempMusic;
double avg = (tempArt + tempEnglish + tempMusic) / 3.0;


You're calculating the average before you've read any values in. What do you think the result of that will be?
Topic archived. No new replies allowed.