这是我的代码,需要通过学生的教职号来检查学生,如果没有信息可以说明...
cout<<"Enter faculty number of the student(8 digits): "<<endl;
cin>>ch;
cout<<"Information about student with number:"<<ch<<endl;
for(i=0;i<n;i++)
{
if(m[i][0]==ch)
{
for(j=0;j<4;j++)
cout<<setprecision(8)<<m[i][j]<<"\t";
}
else if(m[i][0]!=ch)
{
cout<<"No information about this student"<<endl;
}
}
它工作得很好,问题是如果我的“n”(从此代码中输入的学生人数)是 3 ......我们将有 3 个学生,并且循环“for”将进行 3 次......然后我们输入1 名学生(实际上我们正在输入 1 个教职员工编号)当我启动程序时,它会显示有关该学生的全部信息,并在两个新行中显示“没有关于该学生的信息”。我不能用 N 将 IF 检查从 FOR 中取出,因为我需要滚动 m[i]...谢谢