1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
#include <iostream> #include <string> #include <vector> using namespace std; int main() { vector<string> questions; vector<string> answers; vector<int> finalScore; vector<string> studentName; int numOfStudents; int numOfQuestions; int score = 0; string studentAnswer; cout << "\t\tScoring System"; cout <<"\nEnter the number of questions for the test: "; cin >> numOfQuestions; for(int i=1; i <= numOfQuestions; i++) { string question; string answer; cout <<"\nEnter question number "<< i <<"\n"; cin >> question; questions.push_back(question); cout <<"\nEnter the answer for question number "<< i <<"\n"; cin >> answer; answers.push_back(answer); } cout <<"\nHow many students will be taking this test? "; cin >> numOfStudents; string name; for( int i=1; i<=numOfStudents; i++) { cout <<"\nPlease enter your name: "; cin >> name; studentName.push_back(name); for(unsigned int i = 0; i<=questions.size(); ++i) { cout <<"\n" << questions[i]; cin >>studentAnswer; for (unsigned int i=0; i <= answers.size(); ++i) { if(studentAnswer == answers[i]) { score++; } } } } }