求大神帮助写个封面

IT菜鸟丶Java 2013-06-23 07:15:21
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int j=0;
typedef struct student
{
string name;
int num;
int clas[3];
} st;
void dl(string s1,st p[])
{
int t;
for(int i=0;i<j;i++)
{
if(s1==p[i].name)
{
t=i;
}
}
for(i=t;i<j;i++)
{
p[i]=p[i+1];
}
}

int cx1(string s1,int k,int h,st p[])
{

string s2,s3,s4;
s2="数学";
s3="英语";
s4="语文";
for(int i=0;i<j;i++)
{
if(s1==s4)
{
if(p[i].clas[0]>=k&&p[i].clas[0]<=h)
{
cout<<"姓名 学号 语文 数学 英语"<<endl;
cout<<p[i].name<<" "<<p[i].num<<" "<<p[i].clas[0]<<" "<<p[i].clas[1]<<" "<<p[i].clas[2]<<endl;
return 0;
}
}
else if(s1==s2)
{
if(p[i].clas[1]>=k&&p[i].clas[1]>=h)
{
cout<<"姓名 学号 语文 数学 英语"<<endl;
cout<<p[i].name<<" "<<p[i].num<<" "<<p[i].clas[0]<<" "<<p[i].clas[1]<<" "<<p[i].clas[2]<<endl;
return 0;
}
}
else if(s1==s3)
{
if(p[i].clas[2]>=k&&p[i].clas[2]<=h)
{
cout<<"姓名 学号 语文 数学 英语"<<endl;
cout<<p[i].name<<" "<<p[i].num<<" "<<p[i].clas[0]<<" "<<p[i].clas[1]<<" "<<p[i].clas[2]<<endl;
return 0;
}
}

}
cout<<"没有找到";
return 0;

}

int cx(string s1,st p[])
{

for(int i=0;i<j;i++)
{
if(s1==p[i].name)
{
cout<<"姓名 学号 语文 数学 英语"<<endl;
cout<<p[i].name<<" "<<p[i].num<<" "<<p[i].clas[0]<<" "<<p[i].clas[1]<<" "<<p[i].clas[2]<<endl;
return 0;
}
}
cout<<"没有找到";
return 0;

}
void paixu(st p[])
{
st t;
for(int i=0;i<j;i++)
{
for(int h=0;h<j-i-1;h++)
{
if(p[h].clas[0]>p[h+1].clas[0])
{
t=p[h];
p[h]=p[h+1];
p[h+1]=t;
}
}
}
for(i=0;i<j;i++)
{
cout<<"姓名 学号 语文 数学 英语"<<endl;
cout<<p[i].name<<" "<<p[i].num<<" "<<p[i].clas[0]<<" "<<p[i].clas[1]<<" "<<p[i].clas[2]<<endl;
}
}
void paixu1(st p[])
{
st t;
for(int i=0;i<j;i++)
{
for(int h=0;h<j-i-1;h++)
{
if(p[h].clas[1]>p[h+1].clas[1])
{
t=p[h];
p[h]=p[h+1];
p[h+1]=t;
}
}
}
for(i=0;i<j;i++)
{
cout<<"姓名 学号 语文 数学 英语"<<endl;
cout<<p[i].name<<" "<<p[i].num<<" "<<p[i].clas[0]<<" "<<p[i].clas[1]<<" "<<p[i].clas[2]<<endl;
}
}
void paixu2(st p[])
{
st t;
for(int i=0;i<j;i++)
{
for(int h=0;h<j-i-1;h++)
{
if(p[h].clas[2]>p[h+1].clas[2])
{
t=p[h];
p[h]=p[h+1];
p[h+1]=t;
}
}
}
for(i=0;i<j;i++)
{
cout<<"姓名 学号 语文 数学 英语"<<endl;
cout<<p[i].name<<" "<<p[i].num<<" "<<p[i].clas[0]<<" "<<p[i].clas[1]<<" "<<p[i].clas[2]<<endl;
}
}
void main()
{
st p[10];
string s1,s2,s3,s4;
int choice,t=1,i,k,h;
while(t==1)
{
cout<<"请输入选择:";
cin>>choice;
if(choice==1)
{
cout<<"输入学生姓名:\n";
cin>>p[j].name;

cout<<"输入学生学号."<<endl;
cin>>p[j].num;
cout<<"输入语文成绩:"<<endl;
cin>>p[j].clas[0];
cout<<"输入数学成绩;"<<endl;
cin>>p[j].clas[1];
cout<<"输入英语成绩;"<<endl;
cin>>p[j].clas[2];
j++;
}
else if(choice==2)
{
for(i=0;i<j;i++)
{
cout<<"姓名 学号 语文 数学 英语"<<endl;
cout<<p[i].name<<" "<<p[i].num<<" "<<p[i].clas[0]<<" "<<p[i].clas[1]<<" "<<p[i].clas[2]<<endl;
}
}
else if(choice==3)
{
cout<<"你要删除的学生的姓名:"<<endl;
cin>>s1;
dl(s1,p);
j--;
}
else if(choice==4)
{
cout<<"你要查询的认的名字:";
cin>>s2;
cx(s2,p);
}
else if(choice==5)
{
cout<<"请输入你要查询的成绩项目:";
cin>>s3;
cout<<"请输入你要查询的成绩分数段";
cin>>k>>h;
cx1(s3,k,h,p);
}
else if(choice==6)
{
paixu(p);//语文排序
}
else if(choice==7)
{
paixu(p);//数学排序
}
else if(choice==8)
{
paixu(p);//英语排序
}


else if(choice==9)
{
cout<<"再见"<<endl;
t=0;
}
else
{
printf("输入错误\n");
}
}

}
求大神为此程序写一个显示菜单。
...全文
74 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
yiyefangzhou24 2013-06-26
  • 打赏
  • 举报
回复
他意思吧这段代码出本书,让大神给P个封面
一叶之舟 2013-06-26
  • 打赏
  • 举报
回复
写什么封面。

64,681

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧