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
Select the correct answer from each drop-down menu. Susan has decided to develop a website on a WYSIWYG editor. What kind of set
Natalija [7]

Answer:

the ans is b

Explanation:

i did it on edge

8 0
3 years ago
Where is the worlds biggest cookie​
rjkz [21]

I believe the cookie monster has it

3 0
3 years ago
Read 2 more answers
Your computer is configured to obtain an ipv4 address and dns server address automatically. what utility will help you to find t
dolphi86 [110]
Terminal commands - ifconfig or ipconfig on windows
7 0
3 years ago
Choose the term so achieve the output shown.
Aneli [31]

Answer:

sqrt

Explanation:

4 0
4 years ago
Barbara has three computers connected to the same network in her home. What
Anastaziya [24]

Answer:

LAN

Explanation:

i am not sure but I think it is lan

5 0
3 years ago
Other questions:
  • You are designing a distributed application for Azure. The application must securely integrate with on-premises servers. You nee
    13·2 answers
  • The laws governing search and seizure in the public sector are much more straightforward than those in the private sector. TRUE
    11·1 answer
  • Which of the following are common navigation elements? (Choose all that apply.)
    5·1 answer
  • Which function returns a valid value without any arguments?
    14·2 answers
  • Spreadsheet software can be used to do all the following except _____.
    5·2 answers
  • Suppose Alice and Bob are sending packets to each other over a computer network. SupposeTrudy positions herself in the network s
    11·1 answer
  • What are the 6 major forms that Energy can be grouped into?
    10·1 answer
  • Write a program to accept two numbers<br>in two lines and find Square root of Squares<br>of thion​
    13·1 answer
  • Macro mode is used to take landscape photographs of subjects fairly far from the camera.
    12·2 answers
  • Harry needs to make a presentation on packaging prototypes for a new product. Which presentation software elements can be use to
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!