3 Replies - 5225 Views - Last Post: 01 January 2013 - 03:19 PM Rate Topic: -----

#1 Nedra144  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 01-January 13

error C1075 Visual Studio 2012

Posted 01 January 2013 - 03:00 PM

Hi, I'm new here and new to programming. I'm Getting an error

Error 1 error C1075: end of file found before the left brace '{' at 'c:\documents\visual studio 2012\projects\hi\hi\hi.cpp(9)' was matched c:\documents\visual studio 2012\projects\hi\hi\hi.cpp 91 1 Hi

On this code:

#include "stdafx.h"
#include <iostream>
#include <Windows.h>
#include <string>

using namespace std;

int main()
{
	string manual;
	string aa = " ";
	string ab = " ";
	string ac = " ";
	string ba = " ";
	string bb = " ";
	string bc = " ";
	string ca = " ";
	string cb = " ";
	string cc = " ";
	string column;
	string line;

	cout<<"Welcome to Tic-Tac-Toe V2.0!\n";
	cout<<"Loading...\n";
	Sleep(2000);
	cout<<"Done\n";
	cout<<"Would you like to see the manual? y or n\n";
	cin>>manual;
	if ( manual == "y" )
	{
		cout<<"      User Manual\n";
		cout<<"First, Enter the Column and Line for P1's Move\n";
		cout<<"Reapeat for P2, Continue\n";
		cout<<"When Someone Wins, You will Be Notified and The Game Will End.\n";
		cin.get();
	}
	else if ( manual != "y" )
	{
		cout<<"Then on With The Show!\n";
		Sleep(2000);
	}
	cout<<"X's Move\n";
	cout<<"        Column      \n";
	cout<<"   _________________\n";
	cout<<"   |   | A | B | C |  \n";
	cout<<"   |---|-----------|  \n";
	cout<<" L | A | "<<aa<<" | "<<ab<<" | "<<ac<<" |  \n";
	cout<<" i |---|-----------|  \n";
	cout<<" n | B | "<<ba<<" | "<<bb<<" | "<<bc<<" |  \n";
	cout<<" e |---|-----------|  \n";
	cout<<"   | C | "<<ca<<" | "<<cb<<" | "<<cc<<" |  \n";
	cout<<"   |___|___________|  \n";
	cout<<"Column:\n";
	cin>>column;
	cout<<"Line:\n";
	cin>>line;
	if ( column == "A" ) {
		if ( line == "A" ) {
			aa = "X";
		}
		else if ( line == "B" ) {
			ba = "X";
		}
		else ( line == "C" ); {
			ca = "X";
		}
	}
	else if ( column == "B" ) {
		if ( line == "A" ) {
			ab = "X";
		}
		else if ( line == "B" ) {
			bb = "X";
		}
		else ( line == "C" ); {
			cb = "X";
		}
	}
	else ( column == "C" ); {
		if ( line == "A" ) {
			ac = "X";
		}
		else if ( line == "B" ) {
			bc = "X";
		}
		else ( line == "C" ); {
			cc = "X";
		}
	Sleep(10000);
}



This is supposed to be the start of a tic-tac-toe game...
Hope I can get some help!

Thanks,

Nedra144

Is This A Good Question/Topic? 0
  • +

Replies To: error C1075 Visual Studio 2012

#2 sepp2k  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 2089
  • View blog
  • Posts: 3,181
  • Joined: 21-June 11

Re: error C1075 Visual Studio 2012

Posted 01 January 2013 - 03:11 PM

The error message means that you have more opening braces ({) in your file than closing braces (}). So you forgot a closing brace somewhere - probably after line 88.

PS: The vast majority of C++ programmers will not be able to tell what Visual Studio error number means from the top of their heads. So if you cited the error message, not its number, in the title of your thread, that would be much more helpful.
Was This Post Helpful? 2
  • +
  • -

#3 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5436
  • View blog
  • Posts: 11,658
  • Joined: 02-June 10

Re: error C1075 Visual Studio 2012

Posted 01 January 2013 - 03:18 PM

What part of the error do you not understand? It's pretty plain English.

You have a left brace that is unmatched - meaning where is the matching right brace to close off the block of code?

Somewhere you got your { and } out of match.

I'm not sure if VS does the same for C++ as it does for C# but...

If you put the cursor to the right of any matched pair item like } ) ] the IDE will highlight that character and its mate.
Was This Post Helpful? 1
  • +
  • -

#4 Nedra144  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 01-January 13

Re: error C1075 Visual Studio 2012

Posted 01 January 2013 - 03:19 PM

View PosttlhIn`toq, on 01 January 2013 - 03:16 PM, said:

What part of the error do you not understand? It's pretty plain English.

You have a left brace that is unmatched - meaning where is the matching right brace to close off the block of code?

Somewhere you got your { and } out of match.

Sorry, I looked over the code and didn't notice this, The error is fixed now.

Thanks,

Nedra144
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1