c2181 error in take two stones problem

Hi, I'm in my second week of programming. I'm working on the kattis "take two stones problem as practice for class. I keep getting "illegal else without matching" (error c2181). I know there are other lines that need fixing but this error is driving me crazy, any help would be be much appreciated. please don't solve the two stones problem for me if i'm wrong, thanks.


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
/*  This program is designed to determine who would win in a game of stones where Alice and Bob choose a 2 consecutive stones two at a time 
taking turns until there are no consecutive stones left.  Both players play optimally. If there are an odd number of stones Alice wins
even number of stones Bob wins.  Alice goes first and there are 1000000

1. Create integer representing the number of possible stones 1000000 : N
2. input the value the of N, (1 <= N <= 1000000)
3. Create if else statement to determine winner
4. Create an output to tell who wins
*/

#include <iostream>
#include <cmath>
#include <string>
#include <stdbool.h>


using namespace std;

int main() { 
	int N;

	N = (1 <= N && N <= 10000000); //FIXME'<='; unsafe use of bool //fixed &&
	
	if (N % 2 == 0); 

		cout << N << "Bob Wins!" << endl;
	
	else //(N % 2 == 1); didn't fix // illegal else without matching if c2181
	
		cout << N << "Alice Wins!" << endl;
	


		

	cin.get;
	return 0;
}
Last edited on
if (N % 2 == 0);

Remove that semi-colon.
thanks so much!
Topic archived. No new replies allowed.