Gcse Computing – Guessing game

Lesson Aim

  • Create a program from scratch to solution

Your Task

You need to create a program which asks the user to guess a number between 1 and 10.  If the guess is higher ask the user to guess lower, and if the guess is too low ask the user to guess higher.

Extension Task

Generate a random number for the user to guess.

Limit the number of guesses to 5 if the user doesn’t get the number in 5 guesses print sorry you lost.

Creating a code breaker

Lesson Aim

  • Reinforce creating a program using Procedures and Functions

Your Task

Code Maker (and Breaker) – Lite Version
Write a program that will do the following:

         • Print a menu:
            Code Maker (and Breaker)
            1 – Encode a letter
            2 – Decode a letter
            9 – Exit

Enter an option:
• If ‘1’ is entered, prompt for a letter and use a selection statement to convert the letter into an integer (a = 1, b = 2, etc.).
• If ‘2’ is entered, prompt for an integer, check it is valid (prompt again if invalid) and convert the integer into a letter.
• If ‘9’ is entered, print a goodbye message and exit (break)
• If another value is entered, print an error message and print the menu again.