为什么会停止运行啊!!!急!!!
程序代码:
#include <iostream> using namespace std; class CStudent { public: CStudent(char * n,int i,char * s,int a,char * m,int in); CStudent(void); ~CStudent(void) {} void score(void); void print(void); private: char name[10]; int idnum; int age; char major[10]; char sex[2]; int in_time; char subject[10][10][10]; int grades[10][10]; }; CStudent::CStudent(void){} CStudent::CStudent(char * n,int i,char * s,int a,char * m,int in) { cout<<"请输入姓名,学号,性别,年龄,专业,入学时间:"<<endl; cin>>n>>i>>s>>a>>m>>in; strcpy(name,n); idnum=i; strcpy(sex,s); age=a; strcpy(major,m); in_time=in; cout<<"基本信息已录入!"<<endl; } void CStudent::score(void) { cout<<"请分别输入课程及分数(8门)!"<<endl; int i,j,k; for(i=0;i!=8;++i) { for(j=0;j!=4;++j) { for(k=0;k!=2;++k) cin>>subject[i][j][k]; } cin>>grades[i][j]; } cout<<endl; } void CStudent::print(void) { cout<<"\n"<<"\t"<<"\t"<<"\t"<<"以下为学生基本信息:"<<"\n"<<endl; cout<<"姓名:"<<name<<" "<<"学号:"<<idnum<<" "<<"性别:"<<sex<<" "<<"年龄:"<<age<<" "<<"专业:"<<major<<" "<<"入学时间:"<<in_time<<"\n"<<endl; cout<<" 学科 "<<"\t"<<"学科成绩"<<"\t"<<"学分绩点"<<"\n"<<endl; int i,j,k; for(i=0;i!=8;++i) { for(j=0;j!=4;++j) { for(k=0;k!=2;++k) { cout<<subject[i][j][k]; } } if((grades[i][j]<60)&&(grades[i][j]>=0)) cout<<"\t"<<" "<<grades[i][j]<<"\t"<<"\t"<<"0"<<endl; else if((grades[i][j]>60)&&(grades[i][j]<=80)) cout<<"\t"<<" "<<grades[i][j]<<"\t"<<"\t"<<"1.5"<<endl; else if((grades[i][j]>80)&&(grades[i][j]<=90)) cout<<"\t"<<" "<<grades[i][j]<<"\t"<<"\t"<<"3"<<endl; else cout<<"\t"<<" "<<grades[i][j]<<"\t"<<"\t"<<"5"<<endl; // cout<<"\t"<<grades[i][j]; cout<<endl; } } int main() { CStudent stu("黎明",704,"男",20,"物联网",2011); stu.score(); stu.print(); return 0; } //大学数学 99 大学语文 78 大学英语 99 大学体育 59 大学物理 99 数字逻辑 99 电路分析 99 近现代史 99