【发布时间】:2011-08-16 04:53:04
【问题描述】:
cout << "How many questions are there going to be on this exam?" << endl;
cout << ">>";
getline(cin, totalquestions);
这小段代码来自我创建的一个类中的一个函数,我需要 totalquestions 是一个 int 以便它可以通过 for 循环运行并继续询问我提出的所有问题.
question q;
for(int i = 0; i < totalquestions; i++)
{
q.inputdata();
questions.push_back(q);
}
这段代码在哪里发挥作用?有没有人有任何想法来完成这项工作?
【问题讨论】:
-
请说明您认为不起作用的功能。
-
@ulidtko,实际上,对于这个问题,很容易看出什么不起作用......