Question: I need help writing this question class and the game class. here is my code so far: here is my questionbank.h: #include #include #include #include

I need help writing this question class and the game class. here is my code so far:I need help writing this question class and the game class. here

is my code so far: here is my questionbank.h: #include #include #include

here is my questionbank.h:

#include #include #include #include #include #include

using namespace std;

class QuestionBank {

private: vector questions; vector answers;

public: void LoadQuestions(string fname) { string quest; int ans; ifstream questionsFile; questionsFile.open(fname); if (questionsFile.fail()) { cerr > ans;

//Reading question getline(questionsFile, quest);

//Adding to vector questions.push_back(quest); answers.push_back(ans); }

//Closing file questionsFile.close(); }

//Function that returns the question string getNextQuestion() { int qNo;

//Generating a random number qNo = rand() % (questions.size());

//Return question return questions.at(qNo); } };

here is my main.cpp:

#include "questionbank.h" #include

using namespace std;

int main() { string inputFile; cout > inputFile; QuestionBank questionBank; questionBank.LoadQuestions(inputFile); return 0; }

The Question Class C) Question o text: std::string o answer: std::string o Question) o Question(std:string. std::string) o GetText ()std::string o AnswerContainsDigit (char digit): bool GetAnswerWithPlaceholders(std::vector) o Returns an std:string of the answer but digits in the answer that have not yet been guessed by the user should show an underscore For example, if a vector containing 1, 2, and 3 are passed in and the question's answer is 253, this function returns 2_3 AllDigitsGuessed (std::string) Returns true if no underscore is present in the input string, false otherwise. A simple check that searching an input string for the underscore character. o Use this function on the response from GetAnswerWithPlaceholders

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!