help cant display list for question # of incorrect answers

#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
int choice;
const int empId = 7;
int workers[empId] = {5658846, 4520125, 7895122, 8777541, 8451277, 1302850, 7580489};
int hours[empId];
double payRate[empId];

// Display menu choices
cout << "Select a menu choice: ";
cout << "1. Payroll";
cout << "2. Driver's License Exam";
cout << "3. Quit";
cout << "Please enter your choice: ";
cin >> choice;

if (choice == 1)
{
for (int index = 0; index < empId; index++)
{
cout << "Please enter the hours worked by employee # " << (index+1) << " (ID = " << workers[index] << " ): ";
cin >> hours[index];
cout << "Please enter the pay rate for employee # " << (index+1) << " (ID = " << workers[index] << " ): ";
cin >> payRate[index];

if (hours[index] < 0)
{
cout << "Hours cannot be negative. Please re-enter hours: ";
cin >> hours[index];
}

if (payRate[index] < 6)
{
cout << "The pay rate cannot be les than 6. Please re-enter pay rate: ";
cin >> payRate[index];
}
}


for (int index = 0; index < empId; index++)
{
cout << "This is the wages for each employee:\n";
cout << fixed << showpoint << setprecision(2);
double wages = hours[index] * payRate[index];
cout << "Employee #" << (index + 1);
cout << ": earned $" << wages << endl << endl;
}
}

const int SIZE = 20;
char studentAnswers[SIZE];//student answer
char correctAnswers[SIZE] = {'B', 'D', 'A', 'A', 'C', 'A', 'B', 'A', 'C', 'D', 'B', 'C', 'D', 'A', 'D', 'C', 'C', 'B', 'D', 'A'};
int correct = 0; //variable to count correct answers
int incorrectAnswers = 0; //variable to count invalid answers

for (int index = 0; index < SIZE; index++)
{
cout << "Please enter your answers to your Driver's License Exam questions. " << endl;
cout <<"Enter asnwer for question # " << index + 1 << " : ";
cin >> studentAnswers[index];

if (studentAnswers[index] == 'A' && studentAnswers[index] == 'B' && studentAnswers[index] == 'C' && studentAnswers[index] == 'D')
{
cout << "A,B,C, and D are the only valid inputs. Please try to input the answer again." << endl;
incorrectAnswers++;
--index;

}
}
for (int index = 0; index < SIZE; index++)
{
if (studentAnswers[index] == correctAnswers[index])

correct++;
}

if (correct >= 15)
{
cout << "You have passed the exam." << endl;
}
else
cout << "You have failed the exam." << endl;

cout << "Total number of correct answers: " << correct << endl;
cout << "Total number of incorrect answers: " << 20 - correct << endl;

while (correct >= 15)

return 0;
}
Last edited on
I can't understand your question, if it is a question.
I don't get paid for this so please try and make it easy to understand.

I do not wish to try and read unformatted code.

Please use code tags.
http://www.cplusplus.com/articles/jEywvCM9/


Thx
Topic archived. No new replies allowed.