Writing a program involving if and else

This is the question

Write a complete program  that inputs an integer  value  from the console representing a temperature in degrees F. Your program  should then output  to the console a "B" if that temperature denotes boiling water (212 or greater), "W" if the water is warm (72 .. 211, inclusive), "C" if the water is cold (33 .. 71) or "F" if the water is frozen (32 or less).
Basically, Im confused on how to state that if T is between 72 and 211, then T= W

the . . does not seem like the correct command/code.







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
#include <iostream>
using namespace std;

int main() {
	int T;
	int B;
	int W;
	int C;
	int F;

	cin >> T;
	if (T > 212)
	{ T = B;
	}
	if (T = 72..211)
	{ T = W;
	}
	if (T = 33..71)
	{ T = C;
	}
	if (T < 32)
	{
		T = F;
	}
        cout << T << endl;

	}
	return 0;
}
Last edited on
Pseudo Code:
If T is Greater Than or Equal to 72 and Less Than or Equal to 211,
Assign W to T.
So something like this

1
2
3
4
5
6
7
8
9

If (T >= 72 && T<=211)

{

T=W;

}
Last edited on
Topic archived. No new replies allowed.