我对我正在使用的调试器(Visual C++ 和 Bloodshed Dev C++)的代码有疑问,它只是跳过了应该输入的一行代码左右。这是代码:
for(x = 0; x < TASKLIMIT; ++x)
{
cout<<"Enter the name of a task: ";
getline(cin, task[x].name);
cout<<"Enter the priority of the task: ";
cin>>task[x].priority;
while (task[x].priority > 10 || task[x].priority < 1)
{
cout<<"Enter a number from 1-10: ";
cin>>task[x].priority;
}
cout<<"Enter the estimated completion time of the task: ";
cin>>task[x].completion;
cout<<"Enter the deadline of the task: ";
cin>>task[x].deadline;
}
问题偶尔会移动线路首先它在线路中
cin>>task[x].deadline;
然后它移动到:
getline(cin, task[x].name);
当它到达 for 循环的第二次迭代时
任何帮助,将不胜感激