请求大神帮忙p图们帮忙解决C++程序

一个C++程序问题,求大神帮忙解答,谢谢!_百度知道求大神帮忙解决这个问题c++的_百度知道求大神帮忙用C++编个程序。_百度知道C++ 程序找错题 求大神帮忙解决_百度知道跪求大神帮助,程序有点问题,请大神帮忙改改。下面为部分源代码_c++吧_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:250,819贴子:
跪求大神帮助,程序有点问题,请大神帮忙改改。下面为部分源代码收藏
键盘输入的信息无法写入文件,大神帮忙改改!#include &stdafx.h&#include&iostream&#include&string&#include&fstream&//#pragma comment(lib,&ws2_32.lib&)const int max = 200;class Number{public://编号//姓名//性别&男和女&//年龄
Number(){}
Number(string num, string name, string sex, int age) :num(num), name(name), sex(sex), age(age){}
void input();
void show();
Get_name()
string Get_num()
}};//基类class Teacher : public Number{private://系部//专业
string post_T;//职称public:
Teacher(){}
Teacher(string num, string name, string sex, int age, string system, string major, string post_T) :Number(num, name, sex, age), system(system), major(major), post_T(post_T){}
void input();//输入
void show();//输出
//string get_system(){ }
//string get_major(){ }
//string get_post_T(){ return post_T; }
friend istream &operator&&(istream &in, Teacher &ob);
friend ostream &operator&&(ostream &out, Teacher &ob);};//Teacher类istream &operator&&(istream &in, Teacher &ob){
in && ob.system && ob.post_T && ob.}ostream &operator&&(ostream &out, Teacher &ob){
out && ob.system && ob.post_T && ob.major &&}class Teacher_Manage{
Teacher Tea[max];//记录个数fpublic:
Teacher_Manage()
void Add();//添加
void show();//显示
void search();//查找
void Edit(){}//修改
void Delete();//删除
void Total();//统计
void save();//保存
void read();//读取};void Number::show(){
ifstream in(&f.txt&, ios::in);
cout && &can't open it!& &&
cout && &基本信息:& &&
cout && &姓名& && name
&& &学号& && num
&& &性别& && sex && &年龄& && age &&
in.close();}void Number::input(){
ofstream out(&f.txt&, ios::out);
cout && &can't open it!& &&
cout && &录入基本信息:& &&
cout && &姓名& &&
cout && &学号& &&
cout && &性别& &&
cout && &年龄& &&
out.close();}void Teacher::show(){
ifstream in(&f.txt&, ios::in);
cout && &can't open it!& &&
Number::show();
cout && &系部& && system
&& &专业& && major && &职位& && post_T &&
in.close();}void Teacher::input(){
ofstream out(&f.txt&,ios::out);
cout && &can't open it!& &&
Number::input();
cout && &系部& &&
cout && &专业& &&
cout && &职位& &&
cin && post_T;
out.close();}void Teacher_Manage::Add(){
void Teacher_Menu();
ofstream out(&f.txt&,ios::out);
ifstream in(&f.txt&,ios::in);
cout && &can't open it!& &&
if (top &= max)
cout && &人员已满& &&
cout && &1,输入,0,结束输入& &&
int a = 1;
//fflush(stdin);
if (a == 1)
cout && &请输入你需要添加的人员信息:& &&
t.input();
for (int i = 0; i & i++)
if (t.Get_num() == Tea[i].num)
cout && &该编号已存在!请重新输入:& &&
top=top+1;
out && Tea[i].name&&Tea[i].num&&Tea[i].sex&&Tea[i].age &&t&&
//fflush(stdin);
out.close();
//cout && &y是否继续输入,n是退出输入& &&
//int b = getchar();
if (a == 0)
Teacher_Menu();
}//教师的添加功能void Teacher_Manage::search(){
ifstream in(&f.txt&,ios::in);
ofstream out(&f.txt&,ios::out);
cout && &can't open it!& &&
if (top == 0)
cout && &无人员记录!& &&
void Teacher_Menu();
int j = 1;
if (j == 1)
cout && &输入查询方式:1.按编号查找\t2.按姓名查找& &&
switch (n)
cout && &请输入要查找的编号:\n& &&
for (int i = 0; i & i++)
if (num == Tea[i].num)
cout && &该人员信息如下:& &&
in && Tea[i];
tm.show();
cout && &请输入要查找的姓名:& &&
for (int i = 0; i & i++)
if (name == Tea[i].name)
cout && &该人员信息如下:& &&
in && Tea[i];
//in && Tea[i].name && Tea[i].num && Tea[i].sex && Tea[i].age &&
tm.show();
default:cout && &查无此人!& &&
Teacher_Menu();
in.close();}//教师人员查询void Teacher_Manage::show(){
void Teacher_Menu();
ifstream in(&f.txt&,ios::in);
cout && &can't open it!& &&
if (top == 0)
cout && &无数据!& &&
for (int i = 0; i & i++)
cout && &第i个人员的信息:& && i &&
in && Tea[i];
//in && Tea[i].name&&Tea[i].num&&Tea[i].sex&&Tea[i].age&&t;
//cout && Tea[i].name && Tea[i].num && Tea[i].sex && Tea[i].age &&
Tea[i].show();
Teacher_Menu();
in.close();}//教师显示void Teacher_Manage::Delete(){
void Teacher_Menu();
ofstream out(&f.txt&,ios::out);
ifstream in(&f.txt&, ios::in);
cout && &can't open it!& &&
if (top == 0)
cout && &无数据可操作& &&
cout && &选择删除方法:& &&
cout && &1.编号& && &2.姓名& &&
switch (int x = getchar())
{cout && &请输入要删除的编号& &&
string num1;
cin && num1;
for (int i = 0; i & i++)
in && Tea[i].
if (num1 == Tea[i].num)
for (int j = j & top - 1; j++)
Tea[j] = Tea[j + 1];
out && Tea[j] && top &&
cout && &无此人信息& &&
cout && &请输入要删除的姓名:& &&
for (int i = 0; i & i++)
if (name == Tea[i].name)
for (int j = j & top - 1; j++)
Tea[j] = Tea[j + 1];
out && Tea[j] && top &&
cout && &无此人信息& &&
Teacher_Menu();
out.close();
in.close();}//Teacher人员信息删除操作void Teacher_Manage::Total(){
void Teacher_Menu();
ofstream out(&f.txt&,ios::out);
ifstream in(&f.txt&,ios::in);
cout && &can't open it!& &&
cout && &1.按人数统计 2.按男女统计& &&
int a = 0, b = 0;
switch (a)
cout && &共有& && top && &个& &&
string s = &男&;
string n = &女&;
for (int i = 0; i & i++)
in && Tea[i].
if (s == Tea[i].sex || n == Tea[i].sex)
out && a &&
cout && &男生有& && a && &个& && &\n& && &女生有& && b && &个& &&
Teacher_Menu();
out.close();
in.close();}//Teacher人员信息统计操作void Teacher_Manage::save(){
void Teacher_Menu();
ofstream out(&f.txt&, ios::out);
ifstream in(&f.txt&, ios::in);
cout && &can not!& &&
for (int i = 0; i & i++)
while (cin && Tea[i].name && Tea[i].num && Tea[i].sex && Tea[i].age && t)
out && Tea[i].name && Tea[i].num && Tea[i].sex && Tea[i].age && t &&
Teacher_Menu();
out.close();}void Teacher_Manage::read(){
ifstream in(&f.txt&, ios::in);
void Teacher_Menu();
cout && &打开失败!& &&
int i = 0;
for (; i & i++)
while (in && Tea[i].name && Tea[i].num&& Tea[i].sex && Tea[i].age && t)
//Tea[i].show();
cout && Tea[i].name && Tea[i].num && Tea[i].sex && Tea[i].age && t &&
Teacher_Menu();
in.close();}//void Teacher_Menu(){
Teacher_Manage T_M;
void firstmenu();
cout && &请输入你的选择:& &&
cout && &\t\t& && &1.添加& && &\t& && &\t& &&
cout && &\t\t& && &2.显示& && &\t& && &\t& &&
cout && &\t\t& && &3.查询& && &\t& && &\t& &&
cout && &\t\t& && &4.编辑& && &\t& && &\t& &&
cout && &\t\t& && &5.删除& && &\t& && &\t& &&
cout && &\t\t& && &6.统计& && &\t& && &\t& &&
cout && &\t\t& && &7.保存& && &\t& && &\t& &&
cout && &\t\t& && &8.读取& && &\t& && &\t& &&
cout && &\t\t& && &9.black& && &\t& && &\t& &&
switch (n)
case 1:T_M.Add();
case 2:T_M.show();
case 3:T_M.search();
case 4:T_M.Edit();
case 5:T_M.Delete();
case 6:T_M.Total();
case 7:T_M.save();
case 8:T_M.read();
//case 9:firstmenu();
//cout && &结束请按0!& &&}int _tmain(int argc, _TCHAR* argv[]){
Teacher_Menu();
system(&pause&);
return 0;}
c++,入门/提升/进阶,达内专业IT培训,官方认证,c++,权威课程免费试听,体验才是王道,80天培训入职名企!
登录百度帐号推荐应用
为兴趣而生,贴吧更懂你。或

我要回帖

更多关于 大神帮忙ps 的文章

 

随机推荐