What is the answer?

8 answers
Question:

What is the answer?

[tex]What is the answer?[/tex]


Answers

u look like u smell like goldfish

Explanation:

Uh ty..

Step-by-step explanation:

 

Here is the program that determines the number of questions that the student answered correctly.

#include <iostream>  //to use input output functions

#include <fstream>  // to handle files

#define size 20  //size of questions is fixed to 20

using namespace std;   //to identify objects cin cout

int correctAnswers(char answers[], char correct[]);  //to count correct answers given by student

   int main(){    //start of main function

       char correct[size];         // array stores correct answers

       char answers[size];       //stores answers of students

       int result;                     //stores the correct answers result of student

       double percentage;   //stores the percentage of correct answers

       int counter;        //counts number of correct answers given by student  

       ifstream reader("CorrectAnswers.txt");  //reads the contents of CorrectAnswers.txt file

       if(!reader){  //if file cannot be read/opened

           cout<<"Cannot open the file"<<endl; //displays error message

           return 0;        }          

       counter = 0;    //sets counter to 0 initially

       while( (reader>>correct[counter++]) && counter < size  );    //reads each answer from CorrectAnswers.txt  and stores it in char array correct[] at each iteration of while loop

       reader.close();  //closes the file

       reader.open("StudentAnswers.txt");    //opens StudentAnswers.txt file  

       if(!reader){   //if file could not be opened

           cout<<"Cannot open file"<<endl;   //displays this error message

           return 0;          }          

       counter = 0;    //sets counter to 0

       while( (reader>>answers[counter++]) && counter < size );   //reads each answer from StudentAnswers.txt  and stores it in char array answers[] at each iteration of while loop    

       result = correctAnswers(answers,correct);  //calls correctAnswers method to compute the correct answers given by student and stores the result of correct answers in result variable

       percentage = 100.0*result/size;   //computes percentage of correct answers of student    

       cout<<"The total number of questions answered correctly: "<<result<<endl;     //displays total no of qs answered correctly

       cout<<"The percentage of questions answered correctly: "<<percentage<<" %"<<endl;  //displays computed percentage

       if( percentage >= 75 ){  //if percentage of correctly answered questions is 75% or greater

           cout<<"Student has passed the exam!"<<endl;   } //displays that the student passed the exam

      else { //if percentage of correctly answered questions is below 75%

           cout<<"Student has failed the exam!"<<endl;         }  //displays that the student failed the exam

       return 0;     }  

   int correctAnswers(char answers[], char correct[]){   //method to compute the number of correct answers  

       int countCorrect = 0;   //stores the count of correct answers

       for(int i=0; i<size; i++){  //iterates 20 times to match answers from both the files of 20 questions

           if( answers[i] == correct[i] ){  // if the student answer in StudentAnswers.txt file matches with the correct answer given in CorrectAnswers.txt file

               countCorrect++;              }         }     //adds 1 to the countCorrect every time the student answer matches with the correct answer

       return countCorrect;     }  //returns the number of questions that the student answered correctly

Explanation:

The program is well explained in the comments mentioned with each line of code.

Here are the two files that can be used to check the working of the above program. You can create your own text files too.

     CorrectAnswers.txt :

A

A

B

D

C

C

A

C

D

D

A

B

A

B

B

C

A

C

C

B

StudentAnswers.txt

A

C

B

D

C

C

B

C

D

C

D

B

A

B

B

C

A

C

C

B      

Also if the number of wrong answers are to be displayed then add this method to the above code:

void wrongAnswers(char answers[], char correct[]){  //method takes two arrays one with correct answers and the other with student answers

       for(int i=0; i<size; i++){ //iterates 20 times

           if( answers[i] != correct[i] ){ //if the answer by student does not match with correct answer

               cout<<"Question Number: "<<i+1<<endl; //the question that is answered incorrectly

               cout<<"Correct answer is: "<<correct[i]<<endl;  //displays the correct answer

               cout<<"Student answer is: "<<answers[i]<<endl;    }    }    } //displays the answer that student gave

Now call this method in main() as:

if(result < size){  //if result is less than size i.e. 20

           cout<<"The questions answered incorrectly"<<endl;  //number of questions that are answered incorrectly

           wrongAnswers(answers,correct);  //calls method to compute the wrongly answered questions

       }else{  //if result is not less than size

           cout<<"No incorrect answers."<<endl;       }    //no questions incorrectly answered      

       cout<<"Number of missed questions: "<<size-result<<endl; //displays the number of missed questions

The screenshot of the output is attached.


[tex]One of your professors has asked you to write a program to grade her midterm exams, which consist of[/tex]
[tex]One of your professors has asked you to write a program to grade her midterm exams, which consist of[/tex]

nice.

Explanation:

What

Step-by-step explanation:

Im so confused

you really typed that out

Option A

Explanation:

The atomic number is the number of protons in the nucleus of an atom.

It's a

plasma is the state of matter where the substance is ionized and has no definite shape or volume. the fact of being ionized makes the substance a good electrical conductor.

Similar Solved Works

3 answers

Cual es la respuesta 5%9(12-32)

Cual es la respuesta 5%9(12-32)...
10 answers

The cooling and hardening of magma or lava is called a. deposition b. compaction c. crystallization

The cooling and hardening of magma or lava is called a. deposition b. compaction c. crystallization d. metamorphism...
4 answers

5) In the accompanying diagram of circle 0,mABC = 260. What is m < ABC?

5) In the accompanying diagram of circle 0, mABC = 260. What is m < ABC? [tex]5) In the accompanying diagram of circle 0, mABC = 260. What is m < ABC?[/tex]...
6 answers

Hey everyone first person to respond and join my zo om gets brainlestMeeting ID 956-5332-9486Password jLH7KH

Hey everyone first person to respond and join my zo om gets brainlest Meeting ID 956-5332-9486 Password jLH7KH...
1 answer

ActivityVivian is at a falr In Coachella Valley, California. Much of the valley lies below sea level.

Activity Vivian is at a falr In Coachella Valley, California. Much of the valley lies below sea level. Vivian has brought along an altimeter to measure her elevation at different places in the valley. Vivian's first ride was on the Ferris wheel. When she sat on the wheel at its lowest point, her al...
3 answers

SOMEONE PLS HELP ME ASAP PLSPLS

SOMEONE PLS HELP ME ASAP PLSPLS [tex]SOMEONE PLS HELP ME ASAP PLSPLS[/tex]...
4 answers

Porsentaje de energies de carbon en mexico

Porsentaje de energies de carbon en mexico...
6 answers

10 points, will mark brainlist for the most logical answers. Thank you in advance.

10 points, will mark brainlist for the most logical answers. Thank you in advance. [tex]10 points, will mark brainlist for the most logical answers. Thank you in advance.[/tex]...
4 answers

Identify the correct poetic form for each example.Our Father which art in heaven,Identify the correct poetic form for each example.

Identify the correct poetic form for each example. Our Father which art in heaven, Identify the correct poetic form for each example. Our Father which art in Heaven, Hallowed be thy name. Thy kingdom come. Thy will be done, on earth as it is in heaven. (Luke 11:2) A. Free verse B. rhymed couplet ...
3 answers

While in exile in Babylon, Jews began toA. believe in one God.B construct new temples.C join the Maccabees.D. worship in synagogues.

While in exile in Babylon, Jews began to A. believe in one God. B construct new temples. C join the Maccabees. D. worship in synagogues....
4 answers

 what is it ethical for Wilkins to take the results of Franklin's work and show it to other scientist?

 what is it ethical for Wilkins to take the results of Franklin's work and show it to other scientist?...
5 answers

Can i pay someone to complete my school work for me i need to do a few writting assinments thats alll

Can i pay someone to complete my school work for me i need to do a few writting assinments thats alll i have a few in history and english please help me...
1 answer

The general fund of the city of snake river operates on a calendar year basis. it sends bills to property

The general fund of the city of snake river operates on a calendar year basis. it sends bills to property owners on january 2. taxes are due march 1, but taxpayers are allowed until march 31 to make payment without penalty. taxpayers who pay before march 1 are allowed to deduct a 1 percent discount....
7 answers

Try to guess her name.

Try to guess her name. [tex]Try to guess her name.[/tex]...
3 answers

In living organisms, lipids function mainly asA) sources of stored energy and transmitters of genetic

In living organisms, lipids function mainly as A) sources of stored energy and transmitters of genetic information B) transmitters of genetic information and catalyst of chemical reactions C) catalysts of chemical reactions and components of cellular membranes D) sources of stored energy and compon...
7 answers

19. scientists use meteorites that hit earth to provide evidence of the composition of

19. scientists use meteorites that hit earth to provide evidence of the composition of earth's interior because they hypothesize that...
4 answers

What event is depicted in the painting?

What event is depicted in the painting? [tex]What event is depicted in the painting?[/tex]...
10 answers

The roman empire added new territories mostly by doing what?

The roman empire added new territories mostly by doing what?...
6 answers

Why can't the app give me a straight answer? ​

Why can't the app give me a straight answer? ​...
4 answers

HIPAA recognizes that it is important to be able to freely share informationbetween health care workerswith a patient's familybetween

HIPAA recognizes that it is important to be able to freely share information between health care workers with a patient's family between doctors all of the above PLEEZZZ HELP 20 POINTS...

-- 0.011234--