我正在经历一个永无止境的循环。我在此代码中做错了什么?非常感谢您对我的帮助。
void viewStudents()
{
student *current = head;
do
{
if(current == NULL)
cout<<"Nothing here."<<endl;
else
{
cout<<"Student Name: "<<current->name<<endl;
cout<<"Student's ID Number: "<<current->studentNum<<endl;
cout<<"Student Degree: "<<current->studentDeg<<endl;
cout<<"Student Year Level: "<<current->studentYearLvl<<endl;
cout<<"Student Contact Number: "<<current->studentCont<<endl;
cout<<"Student Email: "<<current->studentEmail<<endl;
cout<<endl;
current = head->next;
}
}
while(current != NULL);
}
答案 0 :(得分:1)
问题是您将RawKeyboard
设置为current
。
您需要将head->next
设置为current
current->next