Есть вот такой класс:
| Код | #ifndef QLIST_H #define QLIST_H #include <string> #include <vector>
using namespace std;
struct Question { string qText; string Answers[5]; int rightAnswer; int points; int qnum; }; class QList { private: public:
QList(); ~QList(); vector<Question> Questions; void AddQuestion(); void DeleteQuestion(int num); void ShowQuestion(int num); };
#endif // QLIST_H
|
И реализация метода:
| Код | void QList::ShowQuestion(int num) { for (vector<Question>::iterator it = Questions.begin() ; it != Questions.end(); ++it) { if (*it->qnum == num) { cout<<*it->qText; break; } } }
|
Компилятор ругается, что error: invalid type argument of unary '*' (have 'int') error: 'std::vector<Question>::iterator' has no member named 'qText' на строки с if и cout соответственно, в чем дело??
|