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....
The use of computers in education is referred to as computer-assisted instruction (CAI). More sophisticated CAI...
The use of computers in education is referred to as computer-assisted instruction (CAI). More sophisticated CAI systems monitor the student’s performance over a period of time. The decision to begin a new topic is often based on the student’s success with previous topics. Modify the following auxiliary program (Computers are playing an increasing role in education. Write a program that will help an elementary school student learn multiplication. Use rand to produce two positive one-digit integers. It should then type...
The use of computers in education is referred to as computer-assisted instruction (CAI). More sophisticated CAI...
The use of computers in education is referred to as computer-assisted instruction (CAI). More sophisticated CAI systems monitor the student’s performance over a period of time. The decision to begin a new topic is often based on the student’s success with previous topics. Modify the c++ program which I included to count the number of correct and incorrect responses typed by the student. After the student types 5 answers, your program should calculate the percentage of correct responses. If the...
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
Provide the instruction type, assembly language instruction, and binary representation of the instruction described by the...
Provide the instruction type, assembly language instruction, and binary representation of the instruction described by the following LEGv8 fields: op = 0x458, Rm = 14, Rn = 16, Rd = 18, shamt = 0
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?
In a computer instruction format, the instruction length is 16 bits and the size of an...
In a computer instruction format, the instruction length is 16 bits and the size of an address field is 4 bits. Is it possible to have: 15 instructions with 3 addresses, 14 instructions with 2 addresses, 31 instructions with one address, and 16 instructions with zero addresses, using this format? Justify your answer.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT