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]
1 year 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]1 year 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
99 points!!! What would happen to the document if the change “A” is pointing to was accepted? a. There would be no changes. b. “
Sophie [7]
Probably, terrific would be inserted
3 0
3 years ago
Read 2 more answers
Please select the word from the list that best fits the definition
Tasya [4]

Answer:

d

Explanation:

because it is

3 0
3 years ago
Read 2 more answers
How can I make a video game?
Rainbow [258]
You first need to figure out what kind of game you would like to create. Find codes and certain websites that will help you set up and or make a game.
3 0
2 years ago
Read 2 more answers
Cloud computing service providers manage different computing resources based on the services they offer. Which resources do IaaS
eimsori [14]

Answer:

1. C.operating system

2. A.applications

Explanation:

1. The Iaas is the infrastructure as a service, and storage, server, and network are the infrastructures. However, the Operating System is the platform, and hence it is the correct option for the first blank. We need to understand the exact meaning of the IaaS, PaaS and the SaaS as well as MaaS, to better understand cloud computing.

2. In the second case, we have been asked about the option that is not being covered by the PaaS, and Paas stands for the platform as a service. And the interface, storage, and virtualization is the platform whereas the Applications is an example of software. And it is being managed by SaaS, Hence, the correct option is A. Applications.

7 0
3 years ago
A _________ is a series of commands and instructions that you group together as a single command to accomplish a task automatica
melamori03 [73]
A macro is a series of commands and instructions that you group together as a single command to accomplish a task automatically.
8 0
3 years ago
Other questions:
  • Which graphic design tool allows you to lay images on top of one another? A. Layers B. Selection C. Drawing D. Color
    10·2 answers
  • A. True
    14·2 answers
  • Okay so I know this is a platform for assignments but I really need a tech expert... So I had a 16 GB SD card and because of eve
    14·1 answer
  • 1)Ce procent de grasimi putem găsi in lapte ?
    10·1 answer
  • A user reports his or her computer is slow to boot. You check the boot order and determine that the computer is checking the C d
    12·1 answer
  • Hi! I'm Kayla! I was wondering who does homework on the weekends... anybody?? I guess almost everyone, including me. Anyways, le
    13·2 answers
  • A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate around the sun. To ac
    14·2 answers
  • The italic button is located on the
    6·1 answer
  • What is the difference between electrical and electronic devices?
    5·2 answers
  • THis took FOREVER! please go check it out, if you have seen my demo to this game, you will like the full version! https://scratc
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!