Skip to content

Commit a1dac29

Browse files
committed
Battleship:
-End game fixed -Thanks and the before closing message done
1 parent e3226bd commit a1dac29

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

Battleship/battleship.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,15 @@ bool isEnd(char grid[9][11], char playerGrid[9][11])
182182
return isEnd;
183183
}
184184

185+
void thanks(void)
186+
{
187+
puts("Thanks for playing!");
188+
puts("");
189+
puts("Shoutouts for the people on Stack Overflow!");
190+
puts("This project was made using Visual Studio Comuity 2019, Excel and Notepad++");
191+
puts("");
192+
}
193+
185194
int main(int argc, char** argv)
186195
{
187196
if (argc < 2)
@@ -277,6 +286,7 @@ int main(int argc, char** argv)
277286
continue;
278287

279288
modifyDisplayGrid(displayGrid, play, grid[play.i][play.j]);
289+
playGrid[play.i][play.j] = grid[play.i][play.j];
280290
clearScreenToTop;
281291
moveTo(0, 0);
282292
printDisplayGrid(displayGrid);
@@ -285,11 +295,12 @@ int main(int argc, char** argv)
285295
{
286296
puts("Game Over!");
287297
playing = false;
288-
fgets(trashcan, 5, stdin);
289298
break;
290299
}
291300
}
292301

293-
302+
thanks();
303+
puts("---Press any key to exit---");
304+
fgets(trashcan, 5, stdin);
294305
return 0;
295306
}

0 commit comments

Comments
 (0)