The following is a game of battleship, but after a few rounds it stops completely and only displays the battle ship... I don't know what the problem is with my code that is making it do this. Can someone give me advice? I would really appreciate it and thanks!
....apparently I'm not the only one who thinks... .>.>; *ducks*.
Load up Code::Blocks or your favourite IDE, I'm highly recommending Code::Blocks for its functionality, it has a debug section at the top.
You *could* do things manually with a debug variable and check every line of code that way, much like throwing errors. So take for instance checking a for loop, I'd use this code.
1 2 3 4
for (int i=0; i<4; i++)
if(debug) cout << i;
That tells me the value of I and how it is progressing. I'd advise specifically to check the logic, especially when using != ...it inverts almost everything.
With an IDE, things are made much more simpler and less labour intensive, just take a look at the Debug menu. A 'debugger' as L B is inferring to, is a tool not a process (like how I was taught in Java (I note this contradicts a previous statement I've made)...but never mind).
Oh ffs. Stop nitpicking, it's pretty obvious given the context what I was referring to. That said, when a compiler displays an error, I call it "throwing a wobbly"... so throwing an error not a stretch.
I call it "throwing a wobbly"... so throwing an error not a stretch.
I'm not kidding, you can't just make up terminology on the spot. The compiler generates errors and code can throw exceptions. The latter is because you actually use the keyword "throw" and the class is actually called std::exception.
//what you wrote
row!=indexrow && column!=indexcolumn
row not_eq indexrow and column not_eq indexcolumn
not( row==indexrow or column==indexcolumn )
//what you intended to write
not( row==indexrow and column==indexcolumn )
row not_eq indexrow or column not_eq indexcolumn
Why would you report that? It's important to use proper terminology in programming. There are plenty of programmers who can not speak English well, and will get confused if you just throw in your own slang. Programming is far from non-demanding when it comes to vocabulary.
@Ravenshade wow you are a genius Thanks so much!!!! It works!! but what exactly does that line of code do?? I set it up to check if the user guesses the battleship they would win... but now it's saying ?? Can you explain this thanks!