Syntax Error C1075: end of file found before the left brace '{' was matched

Every time I try and build the code it says that I have a syntax error and that the end of the file was found before the left brace was matched. I am new to C++ but I have the same number of left braces as right braces in my code. Every time I try and fix the code I get the same error message. If you could help me figure out what is wrong I would much appreciate it!

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

int main() 
{
	double num, power, total;
	char again;

	do 
	{
		cout << "Enter a number: ";
		cin >> num;
		cout << "Enter the power to raise " << num << " to: ";
		cin >> power;

		total = pow(num, power);

		cout << "\n" << num << " to the " << power << " is " << total << "\n";

		do 
		{
			cout << "Do you want to raise another number to a power? ";
			cin >> again;

			if(again != 'Y' || 'y' || 'N' || 'n') {
			cout << "\t" << "Please enter Y or N";
		} while(again != 'Y' || 'y' || 'N' || 'n');

		if(again == 'N' || 'n') cout << "Goodbye, program is terminating";

	} while(again == 'Y' || 'y');

	system("pause");
	return 0;
}
your have an extra right brace on line 26 after the if condition
Last edited on
Oh my gosh! I was staring at this code for 30 minutes and didn't even see that. Thank you so much!!!!!!!!
This is where adopting a consistent indentation style - or, even better, configuring your IDE or editor to do it for you - would help you.
A good code editor should be able to highlight matched braces, place the cursor on either an opening or closing brace and it will highlight the one which matches. Even without changing the formatting of the text, this can help identify such errors very quickly, in fact before you even get as far as compiling the code.
Topic archived. No new replies allowed.