c++ - Trying to use int in getline -
cout << "how many questions there going on exam?" << endl; cout << ">>"; getline(cin, totalquestions); this small piece of code comes function in class have created , need totalquestions int can run through loop , keep asking total amount of questions have asked.
question q; for(int = 0; < totalquestions; i++) { q.inputdata(); questions.push_back(q); } where piece of code comes play? have idea make work?
use
cin >> totalquestions; check errors too
if (!(cin >> totalquestions)) { // handle error }
Comments
Post a Comment