回复 2楼 peach5460
#include <iostream>
#define N 1000
#include <iomanip>
int number=0;
using namespace std;
struct S1
{
char num[20];
char name[20];
char kind;
int
totaltime;
int credit;
};
S1 idea[200];
void mainmeun();
void add(S1 idea[]);
int input(S1 idea[]);
void output(S1 idea[]);
int main()
{
int x;
while(1)
{
cout<<"请选择菜单(0---6)"<<endl;
cin>>x;
switch(x)
{
case 1:input(
idea );break;
case 2:add( idea );break;
case 3:
case 4:output( idea);break;
case 5:
case 0:exit(0);
}
}
return 0;
}
void mainmeun()
{
cout<<"≈≈≈≈≈≈≈≈≈≈≈≈≈≈"<<endl;
cout<<"‖****欢迎来到选课系统****‖"<<endl;
cout<<"‖1-----------输入选修科目‖"<<endl;
cout<<"‖2-----------添加选修科目‖"<<endl;
cout<<"‖3-----------删除已选科目‖"<<endl;
cout<<"‖4-----------查看已选科目‖"<<endl;
cout<<"‖5-----------分类查询科目‖"<<endl;
cout<<"‖0-----------退出选课程序‖"<<endl;
cout<<"≈≈≈≈≈≈≈≈≈≈≈≈≈≈"<<endl;
}
//int add( S1 idea[200])
//{
//cout<<"-----------------------------------------------------------------------------"<<endl;
//
cout<<"课程编号"<<setw(10)<<"课程名称"<<setw(10)<<"课程性质(公共课、必修课、选修课)"<<setw(10)<<"总学时"<<setw(10)<<"学分"<<endl;
//}
int input(S1 idea[])
{
int b;
for(b=0;b<=1000;b++)
cout<<"课程编号
课程名称
课程性质
总学时
总学分"<<endl;
cin>>idea[b].num>>idea[b].name>>idea[b].kind>>idea[b].totaltime>>idea[b].credit;
return b;
}
void output ( int a[],S1 idea[200])
{
int b;
cout<<"
--------------------------------------------------------------------------
"<<endl;
cout<<setw(10)<<"课程编号"<<setw(10)<<"课程名称"<<"
"<<setw(10)<<"课程性质(公共课、必修课、选修课)"<<" "<<setw(10)<<"总学时"<<" "<<setw(15)<<"总学分"<<endl;
cout<<"
--------------------------------------------------------------------------
"<<endl;
for(b=0;b<1000;b++)
cout<<setw(10)<<idea[b].num<<setw(10)<<idea[b].name<<"
"<<setw(10)<<idea[b].kind<<"
"<<setw(10)<<idea[b].credit<<endl;
}
编译的时候没有错,执行有错误帮忙看一下