Visual c++ 使用数组时出现错误

Visual c++ 使用数组时出现错误,visual-c++,Visual C++,我在写一个程序,它应该按等级排序,我还想把名字和它放在一起(还没有完成,我遇到了错误并试图修复错误代码)。但当我试图运行我的程序时,它会接受一个值,然后跳过其余的代码 以下是我写的: #include <iostream> #include <string> using namespace std; int main(){ int numb[7], name[7], Lname[7]; int i, j; char swap; //

我在写一个程序,它应该按等级排序,我还想把名字和它放在一起(还没有完成,我遇到了错误并试图修复错误代码)。但当我试图运行我的程序时,它会接受一个值,然后跳过其余的代码

以下是我写的:

 #include <iostream>
 #include <string>
using namespace std;

int main(){
    int numb[7], name[7], Lname[7];
    int i, j;
    char swap;

    // Taking in and associating names, last names, and grades

    for(i=0;i<=6;i++){
    cout << "Please input the student's name: " << endl;
    cin  >> name[i];
    cout << "Please enter their last name" << endl;
    cin >> Lname[i];
    cout << "Please enter their grade" << endl;
    cin >> numb[i];
 }
    for(i=0;i<=6;i++){
        cout << name[i] << ' ' << Lname[i] << " Got a " << numb << endl;
 }
}
#包括
#包括
使用名称空间std;
int main(){
int numb[7],name[7],Lname[7];
int i,j;
字符交换;
//接受并关联姓名、姓氏和成绩

对于(i=0;i您将数组声明为整数,这意味着您应该是整数值(0到7),而不是字符串(例如实际名称)。不确定这是否是您希望在代码中执行的操作

在第二个for循环中,它也应该是麻木的[i]