I'm attempting to create a 4x4, 6x6 and 8x8 grid for my concentration game, but whenever the game compiles and runs it closes after making the initial selection of the difficulty level. I'm feeling a little panicked as I'm supposed to also include a timer (1, 2, 3 seconds for each choice) and I can't even get my grids to appear.
Any assistance would be greatly appreciated. I've only been learning C++ for about 10 weeks and the instructor has been less than helpful in terms of guidance for this project.
It looks like the problem is in the if-else chain. If you enter valid input, it calls gridSize(), but then doesn't go into the else. It looks like the System("pause") is inside that else. So the code skips the else, hits the end of the main function, and ends.
Try seeing what happens if you enter invalid input the first time.
P.S. The do while loop for valid input ends if they enter an int, not checking if it is a valid one (1,2, or 3)
P.P.S. You can get rid of the if-else chain. Replace it with the do-while you already have, but make the while condition be "input != 1 && input != 2 && input != 3" and then call gridSize() after the loop (when you know the option is valid).
OK it's starting to look better, but now I have two new questions.
1) It's only displaying the first row of the grid. How do I get it to display the various sizes 4x4, etc.? I thought my code towards the end would display whatever grid I wanted based on the selection made by the player, but it's not doing what I want.
2) After I select the difficulty, but before the grid displays we're supposed to have the player select their speed. However I haven't the faintest idea how to do the three different intervals (1 second - Hard, 2 seconds - Medium, 3 seconds - Easy) and since we don't have to keep a score or anything I don't even understand why the time is necessary except to make the program more complex (and stress me out since we never covered this in class).