Explore BrainMass
Share

Explore BrainMass

    C program using functions, switch statements, if statements

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    I have a hard time getting started. The program is to help a student learn multiplication. I have to use the rand function to produce two positive one-digit integers. The program should type a question such as:
    How much is 6 times 7?

    The student will then type the answer. The program will then check the answer . If it is correct, print one of the following messages:

    Very Good!
    Excellent!
    Nice Work!
    Keep up the good work!

    And then ask another multiplication question. If the answer is wrong, print one of the following messages:

    No. Please try again/
    Wrong. Try once more.
    Don't Give up.
    No. Keep trying.
    Then let the student try the same question again repeatedly, until the student gets it right.

    I will have to come with two functions to print the messages. Write a function to print one of the messages when the correct answer is entered and a function to print one of the messages when it is the wrong answer..

    © BrainMass Inc. brainmass.com October 9, 2019, 7:00 pm ad1c9bdddf
    https://brainmass.com/computer-science/c/c-program-using-functions-switch-statements-if-statements-104817

    Solution Preview

    The C code is as follows. It is also attached as a C file.

    #include <stdio.h>
    #include <stdlib.h>

    /* Print message if the answer is correct */
    void PrintCorrect()
    {
    msg[4]=[ "Very Good!",
    "Excellent!",
    "Nice Work!",
    "Keep up the good work!"];
    int ...

    $2.19