Question

In: Computer Science

USE C language :- The use of computers in education is referred to as computer-assisted instruction...

USE C language :- The use of computers in education is referred to as computer-assisted instruction (CAI). Write a program that will help an elementary school student learn multiplication. Use the rand function to produce two positive one-digit integers. The program should then prompt the user with a question, such as
How much is 6 times 7?

The student then inputs the answer. Next, the program checks the student’s answer.

  • If it’s correct, display the message "Very good!" and ask the student if she/he would like to continue. If no terminate the program. if yes ask another multiplication question.
  • If the answer is wrong, display the message "No. Please try again." and let the student try the same question repeatedly until the student finally gets it right.

A separate function should be used to generate each new question. This function should be called once when the application begins execution and each time the user answers the question correctly.

Before ending the program, the program should display how many questions were right and how many questions were answered wrong at the first time it was answered.

Solutions

Expert Solution

Code:

#include <stdio.h>

#include <stdlib.h>

int question() {

    int num1, num2, ans;

    int c = 0;

    num1 = rand() % 10;

    num2 = rand() % 10;

    printf("What is %d times %d ?\n ", num1, num2);;

    scanf("%d", & ans);

    while (ans != (num1 * num2)) {

        c++;

        printf("No. Please try again.\n");

        printf("What is %d times %d ?\n", num1, num2);

        scanf("%d", & ans);

    }

    printf("Very good!\n");

    return c;

}

int main() {

    int n;

    int attempts = 0, corrects = 0;

    int ch = 1;

    while (ch == 1) {

        attempts++;

        n = question();

        if (n == 0)

            corrects++;

        printf("Do you wish to continue(1 = y/ 0 = n)? ");

        scanf("%d", &ch);

    }

    printf("\n\n\nNumber of questions answered correct on first try = %d", corrects);

    printf("\nNumber of questions wrong correct on first try = %d", attempts - corrects);

    return 0;

}

Output:


Related Solutions

6.35 (Computer-Assisted Instruction) The use of computers in education is referred to as computer-assisted instruction (CAI)....
6.35 (Computer-Assisted Instruction) The use of computers in education is referred to as computer-assisted instruction (CAI). Write a program that will help an elementary school student learn multiplication. Use a SecureRandom object to produce two positive one-digit integers. The program should then prompt the user with a question, such as How much is 6 times 7? The student then inputs the answer. Next, the program checks the student’s answer. If it’s correct, display the message "Very good!" and ask another...
IN JAVA Part 1 The use of computers in education is referred to as computer-assisted instruction...
IN JAVA Part 1 The use of computers in education is referred to as computer-assisted instruction (CAI). Write a program that will help an elementary school student learn multiplication. Use a SecureRandom object to produce two positive one-digit integers (you will need to look up how to do this). The program should then prompt the user with a question, such as How much is 6 times 7? The student then inputs the answer. Next, the program checks the student’s answer....
Assisted Instruction: Has to be in PERL SCRIPTING LANGUAGE with NO SUBROUTINES Programming Exercise: Write a...
Assisted Instruction: Has to be in PERL SCRIPTING LANGUAGE with NO SUBROUTINES Programming Exercise: Write a program in PERL with NO SUBROUTINES to allow the user to pick a type of arithmetic problem to study. An option of 1 means addition problems only, 2 means subtraction problems only, 3 means multiplication problems only, 4 means division problems only and 5 means random mixture of all these types. (Computer- Assisted Instruction) The use of computers in education is referred to as...
explain the following types of computers a)analog computers b)digital computers c)hybrid computer
explain the following types of computers a)analog computers b)digital computers c)hybrid computer
In a computer instruction format, the instruction length is 11 bits and the size of an...
In a computer instruction format, the instruction length is 11 bits and the size of an address field is 4 bits. Is it possible to have 5 two-address instructions 45 one-address instructions 32 zero-address instructions using the specified format? Justify your answer.
In a computer instruction format, the instruction length is 12 bits and the size of an...
In a computer instruction format, the instruction length is 12 bits and the size of an address field is 5 bits. The system architect has already designed three 2-address instructions and thirty one 1-address instructions. How many 0-address instructions can still be possibly accommodated?
Franklin Training Services (FTS) provides instruction on the use of computer software for the employees of...
Franklin Training Services (FTS) provides instruction on the use of computer software for the employees of its corporate clients. It offers courses in the clients’ offices on the clients’ equipment. The only major expense FTS incurs is instructor salaries; it pays instructors $5,300 per course taught. FTS recently agreed to offer a course of instruction to the employees of Novak Incorporated at a price of $490 per student. Novak estimated that 20 students would attend the course. Base your answers...
Franklin Training Services (FTS) provides instruction on the use of computer software for the employees of...
Franklin Training Services (FTS) provides instruction on the use of computer software for the employees of its corporate clients. It offers courses in the clients’ offices on the clients’ equipment. The only major expense FTS incurs is instructor salaries; it pays instructors $5,300 per course taught. FTS recently agreed to offer a course of instruction to the employees of Novak Incorporated at a price of $490 per student. Novak estimated that 20 students would attend the course. Base your answers...
Franklin Training Services (FTS) provides instruction on the use of computer software for the employees of...
Franklin Training Services (FTS) provides instruction on the use of computer software for the employees of its corporate clients. It offers courses in the clients’ offices on the clients’ equipment. The only major expense FTS incurs is instructor salaries; it pays instructors $6,000 per course taught. FTS recently agreed to offer a course of instruction to the employees of Novak Incorporated at a price of $700 per student. Novak estimated that 20 students would attend the course. a. Relative to...
Franklin Training Services (FTS) provides instruction on the use of computer software for the employees of...
Franklin Training Services (FTS) provides instruction on the use of computer software for the employees of its corporate clients. It offers courses in the clients’ offices on the clients’ equipment. The only major expense FTS incurs is instructor salaries; it pays instructors $6,000 per course taught. FTS recently agreed to offer a course of instruction to the employees of Novak Incorporated at a price of $700 per student. Novak estimated that 20 students would attend the course. Part 3: FTS...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT