Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // Created by JONLOL on 10/19/2019.
- //
- #include "TestGrader.h"
- void TestGrader::setKey(string correct[])
- {
- for (int x = 0; x < 20; x++)
- {
- answers[x] = correct{x};
- }
- }
- void TestGrader::grade(string test[])
- {
- int correct = 0;
- int incorrect = 0;
- int counter = 0;
- for (int x = 0; x < 20; x++)
- {
- if (test[x] == answers[x])
- {
- correct +=1;
- counter +=1;
- }
- else if (test[x] != answers[x])
- {
- incorrect += 1;
- }
- }
- if (counter >=15)
- {
- cout << "You passed!" << endl;
- }
- else
- {
- cout << "You failed!" << endl;
- }
- cout << "You correctly got: " << correct << " correct answers and: " << incorrect << "incorrect." << endl;
- cout << "The questions you got wrong were: " << endl;
- for (int x = 0; x < 20; x++)
- {
- if (test[x] != answers[x])
- {
- cout << x + 1 << endl;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement