我在使用调试器的代码中遇到问题(Visual C++ & Bloodshed Dev C++),它只是简单地跳过一行代码,或者应该输入的地方。下面的代码: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 loop
任何帮助将不胜感激
它跳过了哪行代码? – 2013-03-22 01:14:04
最有可能的,这些90%欺骗:http://stackoverflow.com/search?q=+%5Bc%2B%2B%5D+getline+skipping – chris 2013-03-22 01:15:08
我编辑它来显示特定行,对不起 – user2197406 2013-03-22 01:16:18