Code compiles and starts running, then stops? no errors found though?

The code is too long to paste here but does anyone know what could cause "project.exe is not working on windows"? the program compiles fine and there are no build errors
http://pastebin.com/ceS4wJNm
Last edited on
Line 58, Rankno isn't being incremented, but the loop continues while it is less that something else, meaning an infinite loop. There might be other things (such as I think a loop started at 1 and ended at the size of an array), but I stopped looking when I found the above.
In the future, use https://gist.github.com/ ;)

Step through your program using the Visual Studio debugger - set a breakpoint before where it crashes and step through your code. You will find the cause of the crash easily.
shadowmouse that was a typo i changed it :') anything else you spotted?
LB we tried that and we havent been able to find anything im afraid :(
Did you call a backtrace when it crashed?
After fixing the stuff shadowmouse pointed out (there were a lot of them), it now crashes for me on line 63:
61
62
63
64
		for(FileNo = 0; RankNo < BoardDimension; FileNo++)
		{
			cout << "|" << Board[RankNo][FileNo];
		}
The loop condition uses RankNo instead of FileNo. This is a classic copypaste error. It seems to work after fixing that.

You should really learn to use your debugger - I was able to find the issue in minutes without knowing anything about the code or what this even is.
Last edited on
Thanks a lot :D yeah im basically self taught so im afraid i never learnt how to use backtraces or break points or debuggers... i just run the code and pray tbh, and try and figure out any errors myself
The debugger is the most helpful tool in all cases, both when you are first learning to program and also when you are a professional. It lets you step through code line by line to see the flow of the program, it shows you where your program crashes and where it gets stuck, it tells you the value of all variables while the program is running, etc. Visual Studio's debugger is widely considered the best one on Windows.

By the way, make sure you're using Visual Studio 2015 so you get the latest and greatest C++ language support.
Topic archived. No new replies allowed.