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
A person is trying to remember a list of 12 different items:
erastova [34]

Answer:

for me personally, it would help if the items were rearranged with like items, for example: snow, sleet, rain, and hail would go together.

so the list should look something like this:

    <u>weather conditions</u>

  • snow
  • sleet
  • hail
  • rain

    <u>fruits</u>

  • strawberry
  • banana
  • apple
  • orange

   <u>sports</u>

  • football
  • soccer
  • tennis
  • rugby

hope i helped <3 have a nice day

5 0
3 years ago
Read 2 more answers
Software that controls a computer. an os controls how system resources are used and provides a user interface, a way of managing
nataly862011 [7]
For bad software, probably a virus/malware/ransomware kind of thing. If it is good software, probably a program that organizes your files, adjusts certain things, but do not record your files (no programs are at the top of my head, sorry).
4 0
3 years ago
Create a 4x5 matrix with ones everywhere and zeros on the last row.
Stells [14]

Answer:

#include <iostream>

using namespace std;

int main() {

   int a[4][5];//declaring a matrix of 4 rows and 5 columns.

   for(int i=0;i<4;i++)

   {

       for(int j=0;j<5;j++)

       {

           if(i==3)//initializing last row as 0.

           {

               a[i][j]=0;

           }

           else//initializing last row as 1.

           {

               a[i][j]=1;

           }

       }

   }

   for(int i=0;i<4;i++)

   {

       for(int j=0;j<5;j++)

       cout<<a[i][j]<<" ";//printing the matrix.

       cout<<endl;

   }

return 0;

}

Output:-

1 1 1 1 1  

1 1 1 1 1  

1 1 1 1 1  

0 0 0 0 0

Explanation:

I have created a matrix of size 4 rows and 5 columns.I have used for loops to fill the array.To fill the last row with 0 i have used if statement.else we are filling it with 1.

7 0
3 years ago
Choose the correct answer base on the Components of Computer System
kondor19780726 [428]
1 - b - Excel is a computer program, so it'd be Software
2 - a - Process of elimination, haven't heard of the term 'peopleware' before.
3 - d - A joystick accepts input from a user to interact with a computer. ex. Flight Simulators
4 - c - A monitor will display (or output) an image based on what is received from the computer.
4 0
3 years ago
Why do people enjoy codehs
Alex73 [517]

Answer: this is a moral question, but here is my view

Explanation:

we get to learn about things like java which i am currently learning for AP computer science A

6 0
3 years ago
Other questions:
  • Which action could be used to determine if a host is compromised and flooding traffic onto the network?
    6·1 answer
  • Which statement prints "hi" on the screen?
    5·2 answers
  • I need help making this table in html code I have some of chart done but idk where to go after the 6:30pm part
    13·1 answer
  • The _____ handles the instructions for your computer to start up before the operating system is loaded.
    10·1 answer
  • PrimeFactorization.java: Write a program that begins by reading in a series of positive integers on a single line of input and t
    12·1 answer
  • Fill in the blanks to make the factorial function return the factorial of n. Then, print the first 10 factorials (from 0 to 9) w
    6·1 answer
  • Develop a C program that calculates the final score and the average score for a student from his/her (1)class participation, (2)
    9·1 answer
  • Answer This One Question Right For Brainliest
    10·1 answer
  • List four tasks that humans perform frequently, but which may be difficult for a computerized agent to accomplish. Describe the
    9·1 answer
  • In Python write a program that reads a list of integers into a list as long as the integers are greater than zero, then outputs
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!