Number guessing game wont compile

This is my first attempt at using "if" and "else" (following the tutorial) Doesn't appear to be working. Any suggestions?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>
using namespace std;

int main ()
{
  int n;
  cout << "Guess a number > ";
  cin >> n;
  if (n == 10);
  {
  cout << "You have guessed the correct number." << endl;
  system("pause");
  
  }else
   cout << "You have guessed the incorrect number." << endl;
  system("pause");
}
Last edited on
Get rid of the semicolon on line 9.
closed account (Dy7SLyTq)
that shouldnt matter though. well it will produce unexpected results but should compile. wait im thinking of while. never mind i think branflakes is right
Thank you, removing the semicolon on line 9 fixed it. I can't believe all these little mistakes I'm making with this. Usually I have a great deal of attention to detail.
Topic archived. No new replies allowed.