Right now, I'm making a quiz where my program reads from a .txt file. I can use getline to read the answers from the .txt using fstream. For example, I have the the string "A. greater B. equal C. less D. invalid"
I've named the string containing this read line answers
I would like it so that each one of my answers A. greater, B. equal, C. less, D. invalid are each put on a separate line. Would the find function work okay here? So far, I haven't had much success.
I should mention that I do get a slight error when using size_t and find. For example, when trying to get question D, I would do this:
size_t posD = question.find("D.");
string strD = question.substr(posD);
string test(strD, question.end());
But, I get an error that says "no instance of constructor matches the argument list" on strD. Is there a fix?
Cheers