I have a class which includes a vector if strings so I can have infinite answers (I'm using this to study by essentially making mock tests). However, when I create thingy, it gets mad at me while trying to have values in the vector. I've tried a lot of ways to get it to work, but it can't.
#include <iostream>
#include <vector>
using namespace std;
string input;
class answer {
public:
vector<string> answers;
};
class qANDa {
public:
string question;
answer answers;
string correct;
};
void askQuestion (qANDa bob) {
cout << bob.question;
getline(cin, input);
input[0] = tolower(input[0]);
if (input == bob.correct) {
cout << "Correct!\n";
} else {
cout <<"Incorrect. Study more. Loser.\n";
};
}
vector<qANDa> thingys;
int main(int argc, const char * argv[]) {
qANDa thingy = {"The correct answer is \"A\". What's the correct answer.", {} "A"}
askQuestion(thingys.at(0));
}
I've tried putting strings inside the brackets, I've tried using parenthesis inside the bracket, I've put strings inside the parenthesis inside the bracket, but none of it works.
answer()instead of the{}empty brackets?