Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ASAP IN C++! (80% of the program already done) DO NOT ANSWER IF CODE DOESN'T COMPILE AND RUN AS DESIRED! YOU WILL BE REPORTED AS

ASAP IN C++! (80% of the program already done)

DO NOT ANSWER IF CODE DOESN'T COMPILE AND RUN AS DESIRED! YOU WILL BE REPORTED AS SPAM.

Please correct the following program so it works as the following:

in C++, create a program that reads a text file (with the content and format as shown below):

MC How many digits does a binary systems use 1 incorrect 2 correct 3 incorrect 4 incorrect MC What is the binary value for 5 010 incorrect 100 incorrect 011 incorrect 101 correct MC What is the binary value for 7 010 incorrect 101 incorrect 111 correct 011 incorrect MC What is the binary value for 2 010 correct 000 incorrect 101 incorrect 111 incorrect

For each question read, you should create a nice display as follows:

Question: How many digits does a binary systems use

Answers:

a) 1

b) 2

c) 3

d) 4

Enter your answer:

After the user enters the answer, you should give feedback such as:

your answer is correct/incorrect

Correct answer is:

The program should keep doing this as long as there are questions in the file.

Source Code:

# include # include

using namespace std;

int main() {

const int size = 50; char mc[size]; char Question[ size ]; char a[ size ]; char ar[ size ]; char b[ size ]; char br[ size ]; char c[ size ]; char cr[ size ]; char d [ size ]; char dr[ size ]; const char* answer[size]; char useranswer[size]; char cor[size]= "correct";

ifstream infile; infile.open("Question.txt"); while ( infile ) {

if (infile == false) cout

cout > useranswer; if (useranswer == answer[size]) cout

}// end while

// system ("pause"); }

Current Ouput: (Answer detection is not working correctly)

image text in transcribed

Desired Ouput:

image text in transcribed

Output Proy (Build, Run) x Proy (Run) x Question: How many digits does a binary systems use Answers: a) 1 b)2 d) 4 Enter your answer: Your answer is not correct, correct answer is: 0xffffc710 Question: What is the binary value for 5 Answers: a) 010 b) 100 c) 011 d) 101 Enter your answer: 0xffffc710 Your answer is not correct, correct answer is: Oxffffc7fo Question: What is the binary value for 7 Answers: a) 010 b)101 c)111 d) 011

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Graph each function. (x) = [[x - 3]]

Answered: 1 week ago

Question

Write a note on Naming and security in Distributed System.

Answered: 1 week ago

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago