Hello all,
First off, I'll just let you guys know that I'm really new at this.
I need some help with a simple C++ program using arrays and loops to create a 20 question quiz. The only thing the program needs to accomplish is allow the user to enter 20 multiple choice answers A,B,C, or D and compare the user entered answers to a correct set of answers to calculate a percentage of correct answers entered. If anyone could just point me in the right direction, or give me a quick example of what I should have, that would be greatly appreciated.
This is what I have so far.. but its not much.
#include <iostream>
using namespace std;
int main()
{
const int NUM_QUESTIONS = 20;
char user_answers[NUM_QUESTIONS];
char correct_answers[NUM_QUESTIONS];
int count;
int correct;
char correct_answers[count] = {B, D, A, A, C, A, B, A, C, D, B, C, D, A, D, C, C, B, D, A}
cout << "\t\t*******************************\t\t\n";
cout << "\t\t*****Driver's License Exam*****\t\t\n";
cout << "\t\t*******************************\t\t\n\n";
for (count = 0; count < NUM_QUESTIONS; count++)
{
cout << (count + 1) << ". ";
cin >> user_answers[count];
}
if (user_answers[count]==correct_answers[count])
{
correct++;
}
cout << endl;
cout << correct;
return 0;
}
Thanks