1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Lostsunrise [7]
2 years ago
7

Write a C++ program to grade the answers to a true-false quiz given to students in a course. The quiz consists of 5 true-false q

uestions. Each correct answer is worth 2 points.
Computers and Technology
1 answer:
Eddi Din [679]2 years ago
7 0

The quiz program is an illustration of loops and conditional statements

  • Loops are used to perform repetition
  • Conditional statements are used to make decisions

<h3>The quiz program</h3>

The quiz program written in C++, where comments are used to explain each action is as follows:

#include <iostream>

using namespace std;

int main(){

   //This prints the instruction

   cout<<"Enter T/t for True; F/f for False\n";

   //This initializes the question

   string questions[5] = { "Q1", "Q2", "Q3", "Q4", "Q5"};

   //This initializes the correct options

   char options[5] = { 'T','T','F','F','T'};

   //This declares the user response

   char opt;

   //This initializes the score to 0

   int score = 0;

   //This loop is repeated 5 times

   for (int i = 0; i < 5; i++){

       //This prints the current question

       cout << i + 1 <<". "<<questions[i]<<"\nAnswer: ";

       //This gets the user response

       cin>>opt;

       //If the user response is correct

       if(toupper(opt) == options[i]){

           //The score is incremented by 2

           score+=2;

       }

   }

   //This prints the total score

   cout<<"Score: "<<score;

   return 0;

}

Read more about loops at:

brainly.com/question/19347842

You might be interested in
Transmits data as pulses of light through tiny tubes of glass Uses standard telephone lines to create a high-speed connection Co
defon

Answer:

The answer is "True".

Explanation:

To transfer data, the fiber optic wire used a high-speed data transmission medium, which includes a small glass or plastic polymers, that carry the light beam to transmit data through swift light flashes through the cable.

  • It enables the transmission of data more quickly over larger distances.
  • In this cable, the traditional cable use to provide web data transfer to cable TV, that why the given statement is true.
4 0
3 years ago
Code a call to the function anotherFunc passing the array myints.
mario62 [17]

Answer:

d)anotherFunc(myints);

Explanation:

When we call a function we just have to pass the names of the arguments to the function.In case of arrays we also just have to pass the name of the array.We don't have to worry about the square brackets.So the function call will be like this.

anotherFunc(myints);

Hence the answer is option d.

4 0
3 years ago
3.5 Lesson practice quiz: Edhesive Question 5
Fed [463]

Answer:

There is an error, the else should be after the elif

Explanation:

5 0
2 years ago
The term load is often used to describe opening a page in a ____. Answer
mote1985 [20]
The answer is b web page
8 0
3 years ago
Some architectures support the ‘memory indirect’ addressing mode. Below is an example. In this case, the register R2contains a p
egoroff_w [7]

Answer:

Following is given the solution to question I hope it will  make the concept easier!

Explanation:

7 0
3 years ago
Other questions:
  • "what is the #1 resource used when researching a product online?"
    5·1 answer
  • The part of the computer that contains the brain or central processing unit is also know as the
    15·2 answers
  • Top/bottom rules allows user to apply conditional formatting cells that fall within the top or bottom numbers or percentile. how
    7·1 answer
  • "Create a Matlab Scrapt that will take the a Matrix A and Matrix B (of AX=B), then calculate the Determinant of Matrix A, Invers
    5·1 answer
  • What are the text or graphics that are lighter than the main text located in a document's background called?
    10·1 answer
  • Write an algorithm that receives a number from the user (you can store the number in a variable called N). Then the algorithm sh
    8·1 answer
  • What are the OSHA construction standards also called ?
    10·1 answer
  • Hi, please help me complete my Database Development 2 hw by completing what should been done from the document and show the code
    11·1 answer
  • What do u mean by generation of computer
    10·1 answer
  • State any three reasons why users attach speakers to your computer​
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!