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
Give at least five (5) practices that you must observe in your classroom.​
atroni [7]

Answer:

Offer second chances/clean slates.

Be resourceful.

Make learning active.

Be an advocate.

Pursue lifelong learning.

8 0
3 years ago
Read 2 more answers
Which of the following tools enables users to connect to a remote computer, including servers with no interaction required from
lana66690 [7]

Answer:

Remote Desktop

Explanation:

This is a software, that enable you to connect with a remote computer with all access. e.g. Team Viewer

3 0
3 years ago
In two to three sentences, describe one advanced search strategy and how it is useful.
Lerok [7]
A search stagey is useful because you can make complicated searches easily and also get reliable data.
6 0
3 years ago
Read the code below.
Rasek [7]

Answer:

theres an error on line one used python idle

Explanation:

8 0
4 years ago
Integrated circuits are made up of _____ that carry the electrical current.
USPshnik [31]
Conductors is the answer
8 0
3 years ago
Other questions:
  • What aspect do you need to keep in mind when you add images in a word document?
    11·2 answers
  • The approved systems design document is used by programmers, the personnel department, and information systems personnel.
    8·1 answer
  • Which email client feature allows you to store the names and information of people you contact frequently?
    5·1 answer
  • What characters cannot be used in a filename?
    15·1 answer
  • Which of these ia an example of gene flow?
    5·1 answer
  • Ana is a music lover. She loves to download songs and videos on her computer every time she hears a new song. One day, her compu
    14·1 answer
  • Describe advantages and disadvantages for microprocessor controlled devices in the household.
    7·1 answer
  • Algorithm to calculate the area of a square.​
    6·1 answer
  • Tommy loves taking care of homing pigeons. He sent a note to his crush who lives 24.0 km away from his house. These birds fly at
    9·1 answer
  • China sends a computer virus that shuts down telephone service in the United States. In retaliation, the United States hacks int
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!