Week 8 Lab
Week 8 Lab
Lab Week 8
Objective of this lab exercise
1. Using pseudo code
2. Random numbers
3. While loops
4. Using Simple ifs
IMPORTANT NOTE
THIS LAB IS A PAPER EXERCISE. THIS MEANS THAT ALL YOUR
ANSWERS HAVE TO BE PREPARED AS HAND WRITTEN NOTES ON
PAPER. FOR THIS LAB YOU SHOULD NOT USE AN IDE.
The purpose of this lab is to develop a program that lets students test their
knowledge of multiplication tables. The program should ask random questions on
multiplying numbers from 1 to 10. It should check the answers and keep the
score. This is the pseudo code of the program.
print welcome message
**************************************************
* CS111 Math tutor *
**************************************************
What is 7 * 4? 28
Well done.
What is 9 * 3? 18
Sorry. The answer should have been: 27
What is 6 * 5? 30
Well done.
Exercise 1 [1 mark]
Exercise 3 [1 mark]
Please write code (on paper) for the following pseudo code:
What are the definitions of the additional constant that you need?
Exercise 4 [1 mark]
Please write code (on paper) for the following pseudo code:
Please write code (on paper) for the complete pseudo code on page 1.
Take into account the following:
• Make sure that your code is properly indented.
• Make sure that you haven't forgotten semicolons at the end of statements.
• Make sure that you use the proper Boolean operations and comparisons
• Use brackets.
• Use good variable names.
• Make sure that you do not have undeclared variables.
• Make sure that you do not read uninitialized variables.
• Set the seed of the random generator.
Convert all the paper based code that you have written into a fully functional C++
program.