网页资讯视频图片知道文库贴吧地图采购
进入贴吧全吧搜索

 
 
 
日一二三四五六
       
       
       
       
       
       

签到排名:今日本吧第个签到,

本吧因你更精彩,明天继续来努力!

本吧签到人数:0

一键签到
成为超级会员,使用一键签到
一键签到
本月漏签0次!
0
成为超级会员,赠送8张补签卡
如何使用?
点击日历上漏签日期,即可进行补签。
连续签到:天  累计签到:天
0
超级会员单次开通12个月以上,赠送连续签到卡3张
使用连续签到卡
01月05日漏签0天
c++编程吧 关注:4,319贴子:7,049
  • 看贴

  • 图片

  • 吧主推荐

  • 游戏

  • 8回复贴,共1页
<<返回c++编程吧
>0< 加载中...

求助高手把我的程序修改,不会改了,这是一个学生信息管理系统

  • 只看楼主
  • 收藏

  • 回复
  • 百变神通小诸葛
  • 大屁孩
    2
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
#include<iostream.h>
void main() //主函数
{
int a;
for(;;) //设置循环,重复使用
{
void zhujiemian(); //调用主界面函数
char
cin>>a;
switch(a) //开关语句,用来调用不同功能的自定义函数
{ case 1:luru(stu,other); break;
case 2:chaxun(stu,other); break;
case 3:xiugai(stu,other); break;
case 4:shanchu(stu,null); break;
case 5:paixu(stu,other); break;
case 6:liulan(stu); break;
}
if(a==0) //退出循环,程序结束
break;
}
}
void zhujiemian() //主界面函数
{
cout<<"---------欢迎使用大学生信息管理系统主菜单--------"<<endl;
cout<<"录入学生信息,请选择:1"<<endl;
cout<<"查询学生信息,请选择:2"<<endl;
cout<<"修改学生信息,请选择:3"<<endl;
cout<<"删除学生信息,请选择:4"<<endl;
cout<<"排序学生信息,请选择:5"<<endl;
cout<<"浏览学生信息,请选择:6"<<endl;
cout<<"退出,请选择:0"<<endl;
}
void luru(student stu[10],student other) //第一个功能函数,录入函数
{
cout<<"请输入学号:"; cin>>other.xuehao;
cout<<"请输入姓名:"; cin>>other.name;
cout<<"请输入出生年份:"; cin>>other.year;
cout<<"请输入出生月份:"; cin>>other.mouth;
cout<<"请输入出生日期:"; cin>>other.day;
cout<<"请输入性别:"; cin>>other.sex;
cout<<"请输入专业:"; cin>>other.zhuanye;
cout<<"请输入联系电话:"; cin>>other.mobile;
cout<<"请输入简介:"; cin>>other.jianli;
for(int i=0;i<10;i++)
if(stu[i].xuehao==0)
{
stu[i]=other;
break;
}
cout<<"录入完成"<<endl;
}
void chaxun(student stu[10],student other) //第三个函数,查询函数
{
cout<<'\t'<<"请输入姓名:"<<endl;
cin>>other.name;
for(int i=0;i<10;i++)
if(strcmp(other.name,stu[i].name)==0)
other=stu[i];
cout<<other.xuehao<<'\n'<<other.name<<'\n'<<other.year<<'\n'<<other.mouth<<'\n'<<other.day<<'\n'<<other.sex<<'\n'<<other.mobile<<'\n'<<other.jianli<<endl;
}
void xiugai(student stu[10],student other) //第三个功能函数,修改函数
{
int b;
cout<<'\t'<<"请输入需要修改信息的学生学号:"<<endl;
cin>>b;
for(int i=0;i<10;i++)
if(b==stu[i].xuehao)
{ stu[i]=null;break; }
luru(stu,other);
cout<<"修改完成"<<endl;
cout<<stu[i].xuehao<<'\n'<<stu[i].name<<'\n'<<stu[i].year<<'\n'<<stu[i].mouth<<'\n'<<stu[i].day<<'\n'<<stu[i].sex<<'\n'<<stu[i].mobile<<'\n'<<stu[i].jianli<<endl;
}
void shanchu(student stu[10],student null) //第四个功能函数,删除函数
{
int b;
cout<<'\t'<<"请输入要删除的学生信息的学号:"<<endl;
cin>>b;
for(int i=0;i<10;i++)
if(b==stu[i].xuehao)
stu[i]=null;
cout<<"该学生信息已删除"<<endl;
}
void paixu(student stu[10],student other) //第五个功能函数,排序函数
{
for(int i=0;i<10;i++)
for(int j=0;j<10-i+1;j++)
if(stu[i].xuehao>stu[j].xuehao)
{
other=stu[i];
stu[i]=stu[j];
stu[j]=other;
}
cout<<"排序已完成"<<endl;
for(i=0;i<10;i++)
{
cout<<stu[i].xuehao<<'\n'<<stu[i].name<<'\n'<<stu[i].year<<'\n'<<stu[i].mouth<<'\n'<<stu[i].day<<'\n'<<stu[i].sex<<'\n'<<stu[i].mobile<<'\n'<<stu[i].jianli<<endl;
cout<<endl;
}
}
void liulan(student stu[10]) //第六个功能函数,浏览函数
{
cout<<"学号"<<'\t'<<"姓名"<<'\t'<<"年份"<<'\t'<<"月份"<<'\t'<<"日期"<<'\t'<<"性别"<<'\t'<<"电话"<<'\t'<<"简历"<<endl;
for(int i=0;i<10;i++)
{
cout<<stu[i].xuehao<<'\t'<<stu[i].name<<'\t'<<stu[i].year<<'\t'<<stu[i].mouth<<'\t'<<stu[i].day<<'\t'<<stu[i].sex<<'\t'<<stu[i].mobile<<'\t'<<stu[i].jianli<<endl;
cout<<endl;
}
}


  • qwe168192
  • 萌妹子
    11
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
自己慢慢调试呗
一眼扫下来第8行就写一个类型(char)无变量无分号,你要搞什么?
剩下就不说了
自己动手丰衣足食


2026-01-05 20:40:33
广告
不感兴趣
开通SVIP免广告
  • xxzLoveYou2012
  • 大屁孩
    2
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
调好了


  • qwe168192
  • 萌妹子
    11
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
#include<iostream>
#include <string>
using namespace std; struct student
{
int xuehao;
string name;
int year;
int mouth;
int day;
char sex; //M 或 F
string zhuanye;
int mobile;
string jianli; }; void zhujiemian();
void luru(student stu[]);
void chaxun(student stu[]); void main() //主函数
{
student stu[10]; //student other; int a; for(;;) //设置循环,重复使用
{
zhujiemian(); //调用主界面函数 cin>>a; switch(a) //开关语句,用来调用不同功能的自定义函数
{
case 1:luru(stu); break;
case 2:chaxun(stu); break;
default:break;
} if(a==0) //退出循环,程序结束 break;
}
} void zhujiemian() //主界面函数
{
cout<<"---------欢迎使用大学生信息管理系统主菜单--------"<<endl;
cout<<"录入学生信息,请选择:1"<<endl;
cout<<"查询学生信息,请选择:2"<<endl;
cout<<"修改学生信息,请选择:3"<<endl;
cout<<"删除学生信息,请选择:4"<<endl;
cout<<"排序学生信息,请选择:5"<<endl;
cout<<"浏览学生信息,请选择:6"<<endl;
cout<<"退出,请选择:0"<<endl;
} void luru(student stu[10]) //第一个功能函数,录入函数
{
for(int i=0;i<10;i++)
{
if (stu[i].day != 0)
{
break;
}
if (i == 10)
{
cout<<"查询不到,或仓库已满"<<endl;
return;
}
}
cout<<"请输入学号:"; cin>>stu[i].xuehao;
cout<<"请输入姓名:"; cin>>stu[i].name;
cout<<"请输入出生年份:"; cin>>stu[i].year;
cout<<"请输入出生月份:"; cin>>stu[i].mouth;
cout<<"请输入出生日期:"; cin>>stu[i].day;
cout<<"请输入性别:"; cin>>stu[i].sex;
cout<<"请输入专业:"; cin>>stu[i].zhuanye;
cout<<"请输入联系电话:"; cin>>stu[i].mobile;
cout<<"请输入简介:"; cin>>stu[i].jianli; cout<<"录入完成"<<endl; }
void chaxun(student stu[10]) //第三个函数,查询函数
{ student other; cout<<'\t'<<"请输入姓名:"<<endl; cin>>other.name; for(int i=0;i<10;i++)
{ if(strcmp(other.name.c_str(),stu[i].name.c_str())==0)
break;
}
if (i == 10)
{
cout<<"查询不到"<<endl;
return;
}else
{
cout<<stu[i].xuehao<<'\n'<<stu[i].name<<'\n'<<stu[i].year<<'\n'<<stu[i].mouth<<'\n'<<stu[i].day<<'\n'<<stu[i].sex
<<'\n'<<stu[i].mobile<<'\n'<<stu[i].jianli<<endl;
}
}


  • qwe168192
  • 萌妹子
    11
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
总结下:
1.未定义结构体,main中传递参数也没定义对象的结构体类型
2.函数声明需要写在main函数之前,main才能调用得到
3.算法需要多想想,需要什么参数也多多思量!
4.书本还是老实点重新看一遍,例题也敲一遍,多调试下


登录百度账号

扫二维码下载贴吧客户端

下载贴吧APP
看高清直播、视频!
  • 贴吧页面意见反馈
  • 违规贴吧举报反馈通道
  • 贴吧违规信息处理公示
  • 8回复贴,共1页
<<返回c++编程吧
分享到:
©2026 Baidu贴吧协议|隐私政策|吧主制度|意见反馈|网络谣言警示