What's wrong with my if statements?

Hello, I'm writing this simple program using continuous if statements. Although it seems to me that I've written everything correctly, when I compile it, there are several errors. I'm a beginner and I don't quite understand yet how to spot and fix my errors. Some insight would be greatly appreciated.

// This program calculates boiling point and freezing point
#include <iostream>
using namespace std;
  
int main () {
  
  int temperature, alcohol, mercury, oxygen, water;
  
  cin >> temperature;
  if (temperature <= -173)
     cout << "alcohol freezes\n";
  if (temperature >= 172)
     cout << "alcohol boils\n";
  if (temperature <= -38)
     cout << "mercury freezes\n";
  if (temperature >= 676)
     cout << "mercury boils\n";
  if (temperature <= -362)
     cout << "oxygen freezes\n";
  If (temperature >= 306) 
     cout << "oxygen boils\n";   
  If (temperature <= 32) 
     cout << "water freezes\n";
  If (temeprature >= 212)
     cout <<  "water boils\n";  
 return 0;
  
}
What are the errors? Please tell us what the compiler is saying is wrong.

Also, use [code] tags around your code instead of output ones.
Last edited on
The last three ifs are in capital which shouldn't be and the last word of temeprature is wrong you should write it like this temperature.
should be like this.
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 temperature, alcohol, mercury, oxygen, water;
  
  cin >> temperature;
  if (temperature <= -173)
     cout << "alcohol freezes\n";
  if (temperature >= 172)
     cout << "alcohol boils\n";
  if (temperature <= -38)
     cout << "mercury freezes\n";
  if (temperature >= 676)
     cout << "mercury boils\n";
  if (temperature <= -362)
     cout << "oxygen freezes\n";
  if (temperature >= 306) 
     cout << "oxygen boils\n";   
  if (temperature <= 32) 
     cout << "water freezes\n";
  if (temperature >= 212)
     cout <<  "water boils\n";  

  system ("pause");
 return 0;
  
}
I see thanks for the input!

Now I still have one more error in which my compiler says

In function âint main()â:
that's not the error. That's telling you where the error is.
There is more to it than that. What is the actual error? All you've written is that the compiler says the error is inside main().
Sorry my mistake! I've fixed all my errors. I'm still learning how to work C++. thanks so much!
it works perfectly with me there is no error. I think it may give you some warnings because you declare some variables and you did not use them.

alcohol, mercury, oxygen, water;
Topic archived. No new replies allowed.