哪位高手给看看下面程序问题出在哪?

tonies tonies 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
下面C++程序运行没提示出错,但结果却有问题。哪位高手帮帮小弟啊
#include<iostream.h>
#include<string.h>
#include<iomanip.h>
// #include"class student.h"
#include<fstream.h>
#include<stdio.h>
#include<stdlib.h>

class student
{
private:
int maxnum;//学生学号最大值
int sno;//学号
char name[6];//姓名
char sex[2];//性别
int age;//年龄
char birth[10];//出生日期
char folk[2];//民族
char mianmao[8];//政治面貌
char department[20];//系别
int banji;//班级
char speciality[20];//专业
char telephone[10];//联系电话
char address[30];//学生详细家庭住址
public:
student()//学生类构造函数
{}
~student()
{}
void enter();//学生信息录入函数
void display();//学生信息输出函数
int getsno()//返回学号
{return sno;}
char *getname()//返回学生姓名
{return name;}
void setsno(int temp)//置学号
{sno=temp;}
int getbanji()//返回班级
{return banji;}
char *getspeciality()//返回专业
{return speciality;}
void change();//学生信息修改函数
void read();
void write();
// void tongji();
};
void student::enter()
{ cout<<"请输入学号"<<endl;
cin>>sno;
cout<<"请输入学生信息"<<endl;
cout<<"学生姓名:"<<endl;
cin>>name;
cout<<"性别(男,女):"<<endl;
cin>>sex;
while(strcmp(sex,"男")!=0&&strcmp(sex,"女")!=0)
{
cout<<"错误请重新输入!"<<endl;
cin>>sex;
}
cout<<"年龄:"<<endl;
cin>>age;
while(age<=15||age>=50)
{
cout<<"错误请重新输入!"<<endl;
cin>>age;
}
cout<<"出生日期:"<<endl;
cin>>birth;
cout<<"政治面貌(团员,预备党员,党员):"<<endl;
cin>>mianmao;
while(strcmp(mianmao,"团员")!=0&&strcmp(mianmao,"预备党员")!=0&&strcmp(mianmao,"党员")!=0)
{
cout<<"错误请重新输入!"<<endl;
cin>>mianmao;
}
cout<<"民族:"<<endl;
cin>>folk;
cout<<"系别:"<<endl;
cin>>department;
cout<<"班级:"<<endl;
cin>>banji;
cout<<"专业:"<<endl;
cin>>speciality;
cout<<"联系电话:"<<endl;
cin>>telephone;
cout<<"家庭住址:"<<endl;
cin>>address;
}

void student::display()
{
cout<<"该学生学号为: "<<sno<<endl;
cout<<"该学生姓名为: "<<name<<endl;
cout<<"该学生性别为: "<<sex<<endl;
cout<<"该学生年龄为: "<<age<<endl;
cout<<"该学生民族为: "<<folk<<endl;
cout<<"该学生生日为: "<<birth<<endl;
cout<<"该学生政治面貌为:"<<mianmao<<endl;
cout<<"该学生系别为: "<<department<<endl;
cout<<"该学生班级为: "<<banji<<endl;
cout<<"该学生专业为: "<<speciality<<endl;
cout<<"该学生电话为: "<<telephone<<endl;
cout<<"该学生地址为: "<<address<<endl;

}
void main()
{
student a;
a.enter();
a.display();
}
...全文

相关推荐

技术资料分享OV7670 software application note很好的技术资料.zip

技术资料分享OV7670 software application note很好的技术资料.zip

2401_88894991

OV7670 Software Application Note.pdf.zip_ov-notes

OV7670 Software Application Note. Very powerfull

朱moyimi

ABAP代码检查(Code Review)

1、SLIN 扩展程序检查 也可通过(SE38工具栏-&gt;检查-扩展程序检查) 进入 2、ATC 检查 通过&lt;SE38菜单栏-检查-ABAP测试主控室&gt; 或事物代码SCI, 支持自定义检查变式 SCI可以配置检查变式满足特殊需求,配置对象集用于批量检查 3、通过ABAP测试主控室实现统一管理,定期检查作业和监控功能(事务代码ATC) 参考 SLIN...

长沙铁道学院-康帅傅

Open3D 教程学习指南 (持续整理)

Open3D 是一个开源库,旨在为 3D 数据处理提供高效且易用的工具。它由 Intel 开发和维护,支持多种 3D 数据处理任务,如点云处理、3D 重建、几何处理和可视化等。

chase。

U8-固定资产月末结账报错:BOF或EOF中有一个是真

度了下,发现此问题一般是由于fa_Vtsobject表缺少对应月份的记录导致,补上即可,但是查看发现此表记录正常。 跟踪后发现定位到以下语句: select * from AccInformation where cSysID = N'FA' and cName =N'bVoucherApply'上述语句执行后没有任何记录显示,但是在正常的账套执行是有记录的,那有可能就是记录丢失导致,执行以下

guizhouakun
评论 12
收藏 已收藏
分享
返回顶部
tonies
VC/MFC 16,550 成员 421,606 内容