I am a c++ beginner. I just want to check students' answers to a set of answer keys. Let say, I have a student and is declare like this:
//Declare and array of student answers;
string student1 [] = {"A", "B", "C", "A", "B","C","A","B","A","A"};
And answer keys are declare like this:
//Declare an array set of answer key
string keys [] = {"A", "B", "C", "A", "B","C","A","B","A","A"};
Imagine answer keys are the correct answers of question from 1 - 10. Then I want to check if the students answer match the declared answer keys:
for(const string &key : keys){
for(const string &answer : answers){
if(key == answer){
cout << "Correct" << endl;
}else{
cout << "Wrong" << endl;
}
}
}
My first problem is, it gives me the following results:
Correct
Correct
Correct
Correct
Correct
Correct
Correct
Correct
Correct
Correct
Correct
Correct
Correct
Correct
Correct
Correct
Correct
Correct
Correct
Correct
Correct
Correct
Correct
Correct
Correct
And the second one is, I want to add 5 more students to check their answer. Thanks.