A programmer is writing a game - AQA - GCSE Computer Science - Question 13 - 2023 - Paper 1
Question 13
A programmer is writing a game. The game uses a 3 x 3 grid containing nine squares.
In the game, a square on the grid is referred to by a letter and a number. For e... show full transcript
Worked Solution & Example Answer:A programmer is writing a game - AQA - GCSE Computer Science - Question 13 - 2023 - Paper 1
Step 1
use the variable check
96%
114 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
Define a boolean variable check and initialize it to false:
bool check = false;
Step 2
while (check == false)
99%
104 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
Use a while loop to repeatedly prompt the user:
while (!check) {
string square = "";
// Additional logic will follow here
}
Step 3
output an error if a grid reference is entered
96%
101 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!