Nov 26, 2012 at 2:12am UTC
I am trying to write a program where some of the input is stored into a vector but when I compile what I have so far for the program, I get an error that says "no operator ">>" matches these operands". I'm guessing I'm missing something that will store the input in the vector.
this is the code i have so far:
#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;
char studentAnswer;
cout << "\t\tScoring System";
cout <<"\nEnter the number of questions for the test: ";
cin >> numOfQuestions;
for(int i=0; i < numOfQuestions; i++)
{
cout <<"\nEnter question number "<< i;
cin >> questions;
cout <<"\nEnter the answer for question number "<< i;
cin >> answers;
}
}
Nov 26, 2012 at 2:27am UTC
After getting the input, push_back that string into the vector and try...its like questions.push_back(strQuestions)
Nov 26, 2012 at 2:40am UTC
Thanks, took a little playing with but I did get it to work using push_back