CS167467 C Programming
Fall 1999

Multiplication practice

Goals

To write a program that uses library functions, and functions as modules to contain subtasks.

Problem description

Write a C program that will help an elementary school student practice multiplication facts. Use the library function rand to generate two single digit numbers to be multiplied. Print a question like:

How much is 6 times 7?

After the student types an answer the program should check it and display a message., such as "Very good!" or "No, it’s 42", and then ask another question. Use rand again to choose one of a samll number of different messages to be displayed in response to the answer. Keep track of the correct and incorrect answers, and print the percentage of correct answers at the end of the session. The student can indicate he wants to stop by typing 9999 as the answer to a question.

Procedure

Follow these steps to end up with a successful program:

  1. Think of the program in terms of at least three separate subtasks, which you should write as separate functions:
    1. generating the question
    2. getting the answer from the student and checking it
    3. printing the response
  2. Write the main program to call these three functions appropriately.
  3. Use srand(time(NULL)) to "re-seed" the random number generator so that the program will produce different questions every time it is run.

Deliverables:

Notes and hints

 

Due Date

Submit your completed assignment before 5pm. on Friday October 8th.