为了正常的体验网站,请在浏览器设置里面开启Javascript功能!

C++课程设计

2017-09-16 50页 doc 332KB 41阅读

用户头像

is_266065

暂无简介

举报
C++课程设计C++课程设计 1、工资管理系统 2、人事管理系统 3、银行储蓄管理系统 4、客房管理系统 5、学生学籍管理系统 6、考试管理系统 7、民航(铁路)订票系统 8、商场销售管理系统 9、水电管理系统 10、证券交易分析系统 11、商场(工厂)库存管理系统 12、公路交通管理系统 1、需求分析; 2、系统总框图; 3、每个模块的设计分析; 4、列出所有定义的函数及说明; 免责声明:文档在线网(文档中国)中所有的文档资料均由文档在线网会员提供。文档在线网会对会员提 供的文档资料进行筛选和编辑,但是并不声明...
C++课程设计
C++课程设计 1、工资管理系统 2、人事管理系统 3、银行储蓄管理系统 4、客房管理系统 5、学生学籍管理系统 6、考试管理系统 7、民航(铁路)订票系统 8、商场销售管理系统 9、水电管理系统 10、证券交易分析系统 11、商场(工厂)库存管理系统 12、公路交通管理系统 1、需求分析; 2、系统总框图; 3、每个模块的设计分析; 4、列出所有定义的函数及; 免责声明:文档在线网(文档中国)中所有的文档资料均由文档在线网会员提供。文档在线网会对会员提 供的文档资料进行筛选和编辑,但是并不声明或保证其内容的合法性、正确性或可靠性。该文档资料的版 权属于提供者所有,有关版权的问题请直接与提供者联系。 5、举例说明1、2个比较有特点的算法; 6、存在的问题与不足及对策; 7、使用说明(操作手册); 8、附上程序源代码; 以上仅提供参考。 1、所写的有效代码不得少于300行,并用A4幅面的纸打印。 2、用A4幅面的纸打印出文档。 3、在程序中,最好使用结构体数组或文件作为数据载体。 4、在程序设计中,可制定菜单、鼠标驱动、图形界面等。 5、允许使用Borland C++(for DOS 或 for Windows)、Visual C++编译器。 根据课程设计完成的质量、正确性和工作量综合评分,具体如下: 1、 文档:50% 2、 程序:50% 免责声明:文档在线网(文档中国)中所有的文档资料均由文档在线网会员提供。文档在线网会对会员提 供的文档资料进行筛选和编辑,但是并不声明或保证其内容的合法性、正确性或可靠性。该文档资料的版 权属于提供者所有,有关版权的问题请直接与提供者联系。 一、需求分析: ............. 免责声明:文档在线网(文档中国)中所有的文档资料均由文档在线网会员提供。文档在线网会对会员提 供的文档资料进行筛选和编辑,但是并不声明或保证其内容的合法性、正确性或可靠性。该文档资料的版 权属于提供者所有,有关版权的问题请直接与提供者联系。 二、程序的主要功能: .. 三、程序运行平台: ..... 四、 系统总框架图 ....... 五、程序类的说明: ..... 六、模块分析 ................. 七、比较有特色的函数 .. 八、存在的不足与对策 .. 九、程序源代码 ............. 免责声明:文档在线网(文档中国)中所有的文档资料均由文档在线网会员提供。文档在线网会对会员提 供的文档资料进行筛选和编辑,但是并不声明或保证其内容的合法性、正确性或可靠性。该文档资料的版 权属于提供者所有,有关版权的问题请直接与提供者联系。 在现代化的企业管理中,人事管理系统有着十分重要的作用,然而,用大型软件系统来 于小型的企事业单位,不啻于“杀鸡用牛刀”,因此小型的的软件对于这种单位自然有十分 重要作用。某小型企业出与这种目的制作了这个人事管理系统 1、添加功能: 添加一个职员的基本信息,包括姓名,工作证号,身份证号码,生日,家庭住址,家 庭电话号码,部门,薪水,性别,职务、 2、删除功能: 能够对一个职员的信息进行删除按姓名进行删除、 3、除全部职员信息: 能够对于全部职员的信息进行删除! 4、显示功能: 显示所有职员的主要信息包括姓名,身份证号码,工作证号,生日、! 5、查找功能: 根据你键入的职员姓名,显示其详细信息! 6、修改功能: 对职员的信息进行修改。 BC30。 具体操作如下: 首先进入bc,打开原代码person.cpp,然后进入原程序,接着选择Options下的Linker,选择Libraries,弹出一个对话框,再选择Graphics library,然后确认即可!! 主 函 数 添 删清修显查 加除空改示找 信信信信信信 息 息 息 息 息 息 免责声明:文档在线网(文档中国)中所有的文档资料均由文档在线网会员提供。文档在线网会对会员提 供的文档资料进行筛选和编辑,但是并不声明或保证其内容的合法性、正确性或可靠性。该文档资料的版 权属于提供者所有,有关版权的问题请直接与提供者联系。 , Date class Date { public: Date(); //Date类的构造函数 void set(); //Date类的设置函数 friend istream & operator >>(istream &in,Date &da); //重载“》” friend ostream & operator <<(ostream &out,Date d); //重载“《” void operator =(Date d); 重载“=” private: int year; //年 int month; //月 int day; //日 }; , people class people { public: people(); //people类的构造函数 friend ostream & operator <<(ostream &out,people p); //重载“〈〈” friend istream & operator >>(istream &in,people &p); //重载“〈〈” void operator =(people p); //重载“=” void set(); //people类的设置函数 char *getname(); //获得姓名 char *getsex(); //获得性别 char *getid(); //获得id char *gettelephone(); //获得电话号码 Date getbirthday(); //获得生日 char *getnumber(); //获得工作证号 void setname(char *); //设置姓名 void setsex(char *); //设置性别 void setid(char *); //设置id void setnumber(char *); //设置工作证号 void setaddress(char *); //设置家庭地址 void settelephone(char *); //设置电话号码 void setbirthday(Date); //设置出生日期 void setsalary(char *); //设置薪水 void setpost(char *); //设置职务 void setdepartment(char *); //设置工作部门 protected: char name[20]; //姓名 免责声明:文档在线网(文档中国)中所有的文档资料均由文档在线网会员提供。文档在线网会对会员提 供的文档资料进行筛选和编辑,但是并不声明或保证其内容的合法性、正确性或可靠性。该文档资料的版 权属于提供者所有,有关版权的问题请直接与提供者联系。 char sex[5]; //性别 char id[20]; //身份证号 char telephone[10]; //电话号码 Date birthday; //出生日期 char number[20]; //工作证号 char address[100]; //家庭地址 char salary[10]; //薪水 char post[20]; //职务 char department[30]; //工作部门 public: people *next; //下一个节点 people *previous; //上一个节点 }; cclass peoplelist:public people { public: peoplelist(); //peoplelist类的构造函数 void set(); //peoplelist类的设置函数 void add(); //添加函数 void display(); //显示函数 void find(); //查找函数 void deleteAll(); //清空函数 void save(); //写入文件 void load(); //读进内存 void modify(); //修改函数 void remove(); //删除函数 private: people *start; //链头 people *end; //链表尾 }; 1. 添加模块 系统将提示用户输入新添加的职员的信息,插入在链表中 2. 显示模块 显示模块将输出所有职员的主要资料 。 3. 修改模块 首先由用户输入要修改的职员的姓名,然后系统用修改函数查找,显示该名职员的资 料,然后系统提示用户输入需要修改的项目和新的资料。 4. 查找模块 首先由用户输入要查找的职员姓名,然后系统用查找函数查找,然后系统就调用输出 函数,输出所查找的职员资料。 免责声明:文档在线网(文档中国)中所有的文档资料均由文档在线网会员提供。文档在线网会对会员提 供的文档资料进行筛选和编辑,但是并不声明或保证其内容的合法性、正确性或可靠性。该文档资料的版 权属于提供者所有,有关版权的问题请直接与提供者联系。 5. 删除模块 首先由用户输入要删除的单个职员姓名,然后调用删除函数,删除该名职员的资料。 6. 清空模块 系统将会把所有职员的资料全部删除,将链表清空。 void peoplelist::remove() { textmode(C80); textbackground(BLUE); clrscr(); gotoxy(10,10); cout<<"please input the name of the studnet you want to remove:"; char n[20]; cin>>n; clrscr(); people *temp; temp=start; while(temp) { if(strcmp(temp->getname(),n)==0) break; } if(temp==NULL) { gotoxy(20,10); cout<<"the student name dosenot exist!"<previous)//删除的节点不是第一个 { temp->previous->next=temp->next; if(temp->next)//删除的节点不是最后一个 temp->next->previous=temp->previous; else end=temp->previous; } else//删除的节点是第一个 { if(temp->next)//删除的节点不是最后一个 { temp->next->previous=NULL; 免责声明:文档在线网(文档中国)中所有的文档资料均由文档在线网会员提供。文档在线网会对会员提 供的文档资料进行筛选和编辑,但是并不声明或保证其内容的合法性、正确性或可靠性。该文档资料的版 权属于提供者所有,有关版权的问题请直接与提供者联系。 start=temp->next; } else start=end=NULL;//删除节点是最后一个,链表只有一个节点 } gotoxy(30,10); cout<<"remove succeed!"<>(istream &in,Date &da); 免责声明:文档在线网(文档中国)中所有的文档资料均由文档在线网会员提供。文档在线网会对会员提 供的文档资料进行筛选和编辑,但是并不声明或保证其内容的合法性、正确性或可靠性。该文档资料的版 权属于提供者所有,有关版权的问题请直接与提供者联系。 friend ostream & operator <<(ostream &out,Date d); void operator =(Date d); private: int year; int month; int day; }; /////////////////////////////////////////// Date::Date() { year=month=day=0; } ///////////////////////////////////////////////////// istream & operator >>(istream &in,Date &da) { A: int y,m,d; in>>y>>m>>d; if(y>2002) { cout<<"error!"<12||m<1) { cout<<"error!"<daysmonth[m]||d<1) { cout<<"error!"<29) { cout<<"error!"<28) { cout<<"error!"<>(istream &in,people &p); void operator =(people p); void set(); void change(); char *getname(); char *getsex(); char *getid(); char *gettelephone(); Date getbirthday(); char *getnumber(); void setname(char *); void setsex(char *); void setid(char *); void setnumber(char *); void setaddress(char *); void settelephone(char *); void setbirthday(Date); void setsalary(char *); void setpost(char *); void setdepartment(char *); protected: char name[20]; char sex[5]; char id[20]; char telephone[10]; Date birthday; char number[20]; char address[100]; char salary[10]; char post[20]; char department[30]; public: people *next; people *previous; }; ///////////////////////////// void people::setdepartment(char *d) { strcpy(department,d); } 免责声明:文档在线网(文档中国)中所有的文档资料均由文档在线网会员提供。文档在线网会对会员提 供的文档资料进行筛选和编辑,但是并不声明或保证其内容的合法性、正确性或可靠性。该文档资料的版 权属于提供者所有,有关版权的问题请直接与提供者联系。 ////////////////////////////// void people::setpost(char *p) { strcpy(post,p); } void people::setsalary(char *s) { strcpy(salary,s); } ////////////////////////////// void people::setname(char *n) { strcpy(name,n); } ////////////////////////////// void people::setsex(char *s) { strcpy(sex,s); } //////////////////////////// void people::setid(char *i) { strcpy(id,i); } /////////////////////////////// void people::setnumber(char *n) { strcmp(number,n); } ////////////////////////////////// void people::setaddress(char *a) { strcpy(address,a); } /////////////////////////////////// void people::settelephone(char *t) { strcpy(telephone,t); } /////////////////////////////////// void people::setbirthday(Date d) { birthday=d; 免责声明:文档在线网(文档中国)中所有的文档资料均由文档在线网会员提供。文档在线网会对会员提 供的文档资料进行筛选和编辑,但是并不声明或保证其内容的合法性、正确性或可靠性。该文档资料的版 权属于提供者所有,有关版权的问题请直接与提供者联系。 } //////////////////////////// char * people::getname() { return name; } /////////////////////////////// char * people::getsex() { return sex; } /////////////////////////////// char * people::getid() { return id; } ///////////////////////////////// char * people::gettelephone() { return telephone; } ////////////////////////////////// Date people::getbirthday() { return birthday; } ///////////////////////////////// char * people::getnumber() { return number; } //////////////////////////////////// void people::set() { next=previous=NULL; } /////////////////////////////// people::people() { next=previous=NULL; } /////////////////////////////////////////////// ostream & operator <<(ostream &out,people p) 免责声明:文档在线网(文档中国)中所有的文档资料均由文档在线网会员提供。文档在线网会对会员提 供的文档资料进行筛选和编辑,但是并不声明或保证其内容的合法性、正确性或可靠性。该文档资料的版 权属于提供者所有,有关版权的问题请直接与提供者联系。 { box(15,5,50,16,4,7); gotoxy(32,8); out<<"Imformation"; gotoxy(20,10); out<<"name:"<>(istream &in,people &p) { box(15,5,50,16,4,7); gotoxy(32,5); cout<<"Information"; gotoxy(20,7); cout<<"name: sex:"; gotoxy(20,9); cout<<"number: id:"; gotoxy(20,11); cout<<"address:"; gotoxy(20,13); cout<<"telephone:"; gotoxy(20,15); cout<<"birthday:"; gotoxy(20,17); cout<<"salary: post:"; gotoxy(20,19); cout<<"department:"; window(27,7,40,7); textbackground(0); 免责声明:文档在线网(文档中国)中所有的文档资料均由文档在线网会员提供。文档在线网会对会员提 供的文档资料进行筛选和编辑,但是并不声明或保证其内容的合法性、正确性或可靠性。该文档资料的版 权属于提供者所有,有关版权的问题请直接与提供者联系。 clrscr(); window(52,7,59,7); textbackground(0); clrscr(); window(28,9,39,9); textbackground(0); clrscr(); window(45,9,62,9); textbackground(0); clrscr(); window(29,11,59,11); textbackground(0); clrscr(); window(31,13,43,13); textbackground(0); clrscr(); window(29,15,40,15); textbackground(0); clrscr(); window(27,17,40,17); textbackground(0); clrscr(); window(52,17,59,17); textbackground(0); clrscr(); window(33,19,50,19); textbackground(0); clrscr(); window(27,7,40,7); textbackground(0); clrscr(); in>>p.name; window(52,7,59,7); textbackground(0); clrscr(); in>>p.sex; window(28,9,39,9); textbackground(0); clrscr(); in>>p.number; window(45,9,62,9); textbackground(0); 免责声明:文档在线网(文档中国)中所有的文档资料均由文档在线网会员提供。文档在线网会对会员提 供的文档资料进行筛选和编辑,但是并不声明或保证其内容的合法性、正确性或可靠性。该文档资料的版 权属于提供者所有,有关版权的问题请直接与提供者联系。 clrscr(); in>>p.id; window(29,11,59,11); textbackground(0); clrscr(); cin>>p.address; window(31,13,43,13); textbackground(0); clrscr(); in>>p.telephone; window(29,15,40,15); textbackground(0); clrscr(); in>>p.birthday; window(27,17,40,17); textbackground(0); clrscr(); in>>p.salary; window(52,17,59,17); textbackground(0); clrscr(); in>>p.post; window(33,19,50,19); textbackground(0); clrscr(); in>>p.department; return in; } ////////////////////////////////////////////// void people::operator=(people p) { strcpy(name,p.name); strcpy(sex,p.sex); strcpy(id,p.id); strcpy(telephone,p.telephone); birthday=p.birthday; strcpy(address,p.address); strcpy(number,p.number); strcpy(salary,p.salary); strcpy(post,p.post); strcpy(department,p.department); } 免责声明:文档在线网(文档中国)中所有的文档资料均由文档在线网会员提供。文档在线网会对会员提 供的文档资料进行筛选和编辑,但是并不声明或保证其内容的合法性、正确性或可靠性。该文档资料的版 权属于提供者所有,有关版权的问题请直接与提供者联系。 /////////////////////////////////////////////// class peoplelist:public people { public: peoplelist(); void set(); void add(); void display(); void find(); void deleteAll(); void save(); void load(); void modify(); void remove(); private: people *start; people *end; }; ///////////////////////////////////////////////// void peoplelist::modify() { textmode(C80); textbackground(BLUE); clrscr(); gotoxy(10,10); cout<<"please input the name of the person you want to modify:"; char n[20]; cin>>n; clrscr(); people *temp; temp=start; while(temp) { if(strcmp(temp->getname(),n)==0) { cout<<*temp; break; } temp=temp->next; } if(temp==NULL) { gotoxy(20,10); cout<<"the person dosenot exist!"<set(); gotoxy(20,18); cout<<"input the item you want to modify:"; char n[10]; cin>>n; gotoxy(20,19); if(strcmp(n,"name")==0) { cout<<"please input the new information:"; char s[100]; cin>>s; temp->setname(s); } else if(strcmp(n,"sex")==0) { cout<<"please input the new information:"; char s[100]; cin>>s; temp->setsex(s); } else if(strcmp(n,"telephone")==0) { cout<<"please input the new information:"; char s[100]; cin>>s; temp->settelephone(s); } else if(strcmp(n,"id")==0) { cout<<"please input the new information:"; char s[100]; cin>>s; temp->setid(s); } else if(strcmp(n,"number")==0) { cout<<"please input the new information:"; 免责声明:文档在线网(文档中国)中所有的文档资料均由文档在线网会员提供。文档在线网会对会员提 供的文档资料进行筛选和编辑,但是并不声明或保证其内容的合法性、正确性或可靠性。该文档资料的版 权属于提供者所有,有关版权的问题请直接与提供者联系。 char s[100]; cin>>s; temp->setnumber(s); } else if(strcmp(n,"address")==0) { cout<<"please input the new information:"; char s[100]; cin>>s; temp->setaddress(s); } else if(strcmp(n,"birthday")==0) { cout<<"please input the new information:"; Date d; cin>>d; temp->setbirthday(d); } else if(strcmp(n,"salary")==0) { cout<<"please input the new information:"; char s[100]; cin>>s; temp->setsalary(s); } else if(strcmp(n,"post")==0) { cout<<"please input the new information:"; char s[100]; cin>>s; temp->setpost(s); } else if(strcmp(n,"department")==0) { cout<<"please input the new information:"; char s[100]; cin>>s; temp->setdepartment(s); } else { cout<<"item incorrect!"<>n; clrscr(); people *temp; temp=start; while(temp) { if(strcmp(temp->getname(),n)==0) break; } if(temp==NULL) { gotoxy(20,10); cout<<"the student name dosenot exist!"<previous) { temp->previous->next=temp->next; if(temp->next) temp->next->previous=temp->previous; else end=temp->previous; } else { if(temp->next) { temp->next->previous=NULL; 免责声明:文档在线网(文档中国)中所有的文档资料均由文档在线网会员提供。文档在线网会对会员提 供的文档资料进行筛选和编辑,但是并不声明或保证其内容的合法性、正确性或可靠性。该文档资料的版 权属于提供者所有,有关版权的问题请直接与提供者联系。 start=temp->next; } else start=end=NULL; } gotoxy(30,10); cout<<"remove succeed!"<next; } out.close(); } ///////////////////////////////////////// void peoplelist::load() { textmode(C80); textbackground(BLUE); clrscr(); fstream in; in.open("people.txt",ios::in|ios::binary|ios::nocreate); if(!in) { 免责声明:文档在线网(文档中国)中所有的文档资料均由文档在线网会员提供。文档在线网会对会员提 供的文档资料进行筛选和编辑,但是并不声明或保证其内容的合法性、正确性或可靠性。该文档资料的版 权属于提供者所有,有关版权的问题请直接与提供者联系。 gotoxy(40,10); cout<<"people.txt can not open!\n"<next; delete temp1; temp1=temp2; } in.seekg(0,ios::beg); start=new people; if(!start) { gotoxy(40,10); cout<<"out of memory!"<set(); temp2=NULL; while(!in.eof()) { in.read((char *)temp1,sizeof(people)); temp1->next=new people; if(!temp1->next) { gotoxy(40,10); cout<<"out of memory!"<previous=temp2; temp2=temp1; temp1=temp1->next; temp2->next=temp1; temp1->previous=temp2; } } 免责声明:文档在线网(文档中国)中所有的文档资料均由文档在线网会员提供。文档在线网会对会员提 供的文档资料进行筛选和编辑,但是并不声明或保证其内容的合法性、正确性或可靠性。该文档资料的版 权属于提供者所有,有关版权的问题请直接与提供者联系。 temp2->next=NULL; end=temp2; start->previous=NULL; in.close(); } ///////////////////////////////// void peoplelist::deleteAll() { textmode(C80); textbackground(BLUE); clrscr(); people *temp1; people *temp2; temp1=start; while(temp1) { temp2=temp1->next; delete temp1; temp1=temp2; } start=end=NULL; gotoxy(30,10); cout<<"delete all!"<set(); if(!newptr) { gotoxy(20,10); cout<<"no memory available,failture!"<>*newptr; if(start==NULL) end=start=newptr; else { newptr->previous=end; end->next=newptr; end=newptr; } gotoxy(20,10); cout<<"add success!"<getname(); gotoxy(25,i); 免责声明:文档在线网(文档中国)中所有的文档资料均由文档在线网会员提供。文档在线网会对会员提 供的文档资料进行筛选和编辑,但是并不声明或保证其内容的合法性、正确性或可靠性。该文档资料的版 权属于提供者所有,有关版权的问题请直接与提供者联系。 cout<getsex(); gotoxy(32,i); cout<getid(); gotoxy(50,i); cout<gettelephone(); gotoxy(64,i); cout<getbirthday(); temp=temp->next; gotoxy(3,i+1); cout<<"-------------------------------------------------------------------- -------"<>name; clrscr(); people *temp; temp=start; while(temp) { if(strcmp(temp->getname(),name)==0) { gotoxy(10,2); cout<<"the information you want:"<next; } if(temp==NULL) { gotoxy(20,10); cout<<"can not find the information!"<格式
; void setnum(int a); 设置科目数 int getnum(); 返回科目数 ~achieve(); 成绩类(achieve)的析构函数 subject &operator=(const subject &); 对科目类(subject)对象重载=号 void INSTRUCTION() 打印一个菜单(提示性语句) void welcome(); 开始界面; ostream &operator<<(ostream &,const subject 对科目类(subject)对象重载输出流 &) ostream &operator<<(ostream &,Inform &) 对学生信息类(Inform)对象重载输出流 ostream &operator<<(ostream &,achieve &) 对成绩类(achieve)对象重载输出流 istream &operator>>(istream &,Inform &) 对学生信息类(Inform)对象重载输入流 istream &operator>>(istream &,achieve &) 对成绩类(achieve)对象重载输出流 istream &operator>>(istream &,subject &) 对科目类(subject)对象重载输入流 程序首先建立一个链表(提示用户输入链表的第一个节点,调用create函数),因为节点的数据是Inform类的对象,所以重载了Inform类的输入函数,又由于Inform类中包含了achieve类,achieve类中包含了subject类,所以又分别重载了achieve类和subject类的输入函数; 接着在提示菜单(void INSTRUCTION())下要完成插入数据,删除数据,查找数据, 修改数据,打印链表,为此,分别设计了对链表进行操作的函数insert,del, search, modify,printlistNode, 为了在printlistNode函数中实现对链表数据的输出,分别重载了Inform,achieve,subject类的输出函数;在基本操作函数中,insert将输入的Inform类的对象(包含各种属性)插入 链表头,printlistNode打印出链表中的各个节点,del删除一个节点。此为链表的基本操作, 免责声明:文档在线网(文档中国)中所有的文档资料均由文档在线网会员提供。文档在线网会对会员提 供的文档资料进行筛选和编辑,但是并不声明或保证其内容的合法性、正确性或可靠性。该文档资料的版 权属于提供者所有,有关版权的问题请直接与提供者联系。 唯一可以称得上是特色算法的只能是search和modify void search(char* sea,listNode *head); 算法: 1. 因为可能有几个节点的信息中与char*相同(如一个寝室号码有几个人相同),所以 定义listNode *t[];用来保存匹配的节点的指针,再定义一个整型变量n来找到的节点个数; 2.用for循环(以查找次数小于节点数为终止条件)查找head->data是否有属性与sea 相同; 此处重载了head->data即Inform类的对象与char *的==号;如果相同,n加1,把该head指针放入t[0]中,t[]的角标变量加1,无论是否相同,都把head指向下一个节点; void modify(listNode *head); 算法: 1.输入要修改的学生的一项资料char* a; 2.调用search(a,head)看能否找到这个节点; 3.如果有则删除这个节点del(head);再输入一个Inform类对象信息,插入即可; 由于时间匆忙以及本人水平有限,本程序存在的问题比较多,自认为主要有以下几个 方面,未尽之处还请各位看官多多斧正。 1. 程序没有对输入的学生信息诸如 学号,姓名,电话号码,寝室号码等进行检测其合 理性,所以在电话号码,寝室号码,学号等中可以输入字母或在名字中可以输入数字就在所 难免了,作为一个学籍管理系统,这样的安全性是致命的。要解决这个问题,就要在重载函 数中加入各种判断语句,工作量比较大。 2. 由于水平有限,没有制作图形界面,在一个单调的黑屏下进行各种操作连我都对输 入各种信息有些失去耐心,何况是用户!(此为死穴,只能继续努力了。) 3. 程序的功能也是一个问题,学生的信息太简单,可进行的操作也少,可能有些功能 实现起来显得有些别扭。 由于做程序时,把所有的文件包含在一个空的中,运行时不能分别编译各个cpp文件,具体为打开.dsw文件,再进行编译连接,运行即可。 密码为:82136 *****************************listNode.h*************************************** *** #ifndef listNode_h 免责声明:文档在线网(文档中国)中所有的文档资料均由文档在线网会员提供。文档在线网会对会员提 供的文档资料进行筛选和编辑,但是并不声明或保证其内容的合法性、正确性或可靠性。该文档资料的版 权属于提供者所有,有关版权的问题请直接与提供者联系。 #define listNode_h #define LEN sizeof(listNode) #include #include #include #include #include #include"Inform.h" #define MAX2 4 class listNode{ public: listNode(){} listNode(Inform &); listNode(listNode &); listNode *create(); listNode *insert(listNode *);//对链表进行插入操作; listNode *del(listNode *,char *);//删除资料中含有char*的节点; void printlistNode(listNode *);//打印链表; ~listNode(); void search(char *,listNode *);//查找链表中含有char*的学生; listNode *modify(listNode *); private: Inform data; static int num; listNode *nextPtr; }; #endif ********************* listNode.cpp********************************* #include"listNode.h" int listNode::num=0; listNode::listNode(Inform &da) { data=da; nextPtr=new listNode[LEN]; } listNode::listNode(listNode ©) //拷贝构造函数。 { data=copy.data; nextPtr=new listNode[LEN]; 免责声明:文档在线网(文档中国)中所有的文档资料均由文档在线网会员提供。文档在线网会对会员提 供的文档资料进行筛选和编辑,但是并不声明或保证其内容的合法性、正确性或可靠性。该文档资料的版 权属于提供者所有,有关版权的问题请直接与提供者联系。 assert(nextPtr!=0); nextPtr=copy.nextPtr; } listNode *listNode::create() //从文件f3.txt中读入链表数据; { listNode *head=NULL; listNode *p1,*p2; p1=p2=new listNode[LEN]; char ch; cout<<"\t输入第一个学生的情况:"<>p1->data; num=num+1; if(num==1) head=p1; else p2->nextPtr=p1; p2=p1; p1=new listNode[LEN]; cout<<"\t要继续输入吗?(y/n): "; cin>>ch; }while(ch=='y'); p2->nextPtr=NULL; cout<<"\t输入学生个数为:"<>insertdata; listNode *p0,*p1; p0=new listNode[LEN]; assert(p0!=0); p0->data=insertdata; p0->nextPtr=NULL; p1=new listNode[LEN]; assert(p1!=0); p1=head; 免责声明:文档在线网(文档中国)中所有的文档资料均由文档在线网会员提供。文档在线网会对会员提 供的文档资料进行筛选和编辑,但是并不声明或保证其内容的合法性、正确性或可靠性。该文档资料的版 权属于提供者所有,有关版权的问题请直接与提供者联系。 head=p0; p0->nextPtr=p1; num+=1; cout<<"The DATA have been inserted into the list."<>ch; if(ch=='y') { if(head==NULL) { cout<data!=DELDATA&&p1->nextPtr!=NULL) { p2=p1; p1=p1->nextPtr; } if(p1->data==DELDATA) { if(p1==head) head=p1->nextPtr; else p2->nextPtr=p1->nextPtr; cout<data<nextPtr; }while(p!=NULL); } void listNode::search(char *sea,listNode *head) { listNode *p=new listNode[LEN]; listNode *t[MAX2]; int n=0,j=0; for(int i=0;idata==sea) { n+=1; while(jnextPtr; } if(n==0) cout<>c; if(c=='y') { cout<<"\t该学生学生资料是 :"<data<=0;j--) cout<data<>ch; search(ch,head); cout<<"\t即将删除该生的资料,确定吗?(y/n)"; char c;cin>>c; if(c=='y') { head=del(head,ch); cout<<"\t输入修改的学生资料: "<>insertdata; head=insert(head); return head; } else return head; } 免责声明:文档在线网(文档中国)中所有的文档资料均由文档在线网会员提供。文档在线网会对会员提 供的文档资料进行筛选和编辑,但是并不声明或保证其内容的合法性、正确性或可靠性。该文档资料的版 权属于提供者所有,有关版权的问题请直接与提供者联系。 listNode::~listNode() { delete [] nextPtr; } ****************************Inform.h************************** #ifndef Inform_h #define Inform_h #include #include #include #include #include #include #include #include"achieve.h" class Inform{ friend ostream &operator<<(ostream &,Inform &); friend istream &operator>>(istream &,Inform &); public: Inform(); Inform(Inform &); int operator==(const Inform &); int operator==(char *); int operator!=(char *); Inform &operator=(Inform &); ~Inform(); private: char *number; char *id; char *name; char *sex; achieve ach; char *phonenumber; char *roomnumber; }; #endif ****************************** Inform.cpp************************************ #include #include"Inform.h" 免责声明:文档在线网(文档中国)中所有的文档资料均由文档在线网会员提供。文档在线网会对会员提供的文档资料进行筛选和编辑,但是并不声明或保证其内容的合法性、正确性或可靠性。该文档资料的版权属于提供者所有,有关版权的问题请直接与提供者联系。 ostream &operator<<(ostream &output,Inform &t) { cout<<"********************基本资料********************"<>a; if(a=='y') { cout<>(istream &input,Inform &t) { cout<<" 姓名: "; input>>t.name; cout<<" 学号: "; input>>t.number; cout<<" 身份证号: "; input>>t.id; cout<<" 性别: "; input>>t.sex; cout<<" 电话号码:"; input>>t.phonenumber; 免责声明:文档在线网(文档中国)中所有的文档资料均由文档在线网会员提供。文档在线网会对会员提 供的文档资料进行筛选和编辑,但是并不声明或保证其内容的合法性、正确性或可靠性。该文档资料的版 权属于提供者所有,有关版权的问题请直接与提供者联系。 cout<<" 寝室号:"; input>>t.roomnumber; cout<<"\t\t要继续输入成绩情况吗?(y/n)"; char a; cin>>a; if(a=='y') { cout<<" \t&&&&&&&&&&&&&成绩情况&&&&&&&&&&&&&"<>ch; (t.ach).setnum(ch); input>>t.ach; } else (t.ach).setnum(0); return input; } Inform::Inform() { id=new char[19]; number=new char[12]; name=new char[10]; sex=new char[4]; phonenumber=new char[8]; roomnumber=new char[4]; } Inform::Inform(Inform &p) { id=new char[19]; assert(id!=0); strcpy(id,p.id); number=new char[12]; assert(number!=0); strcpy(number,p.number); name=new char[10]; assert(name!=0); strcpy(name,p.name); sex=new char[4]; assert(sex!=0); strcpy(sex,p.sex); phonenumber=new char[8]; assert(phonenumber!=0); strcpy(phonenumber,p.phonenumber); 免责声明:文档在线网(文档中国)中所有的文档资料均由文档在线网会员提供。文档在线网会对会员提 供的文档资料进行筛选和编辑,但是并不声明或保证其内容的合法性、正确性或可靠性。该文档资料的版 权属于提供者所有,有关版权的问题请直接与提供者联系。 roomnumber=new char[4]; assert(roomnumber!=0); strcpy(roomnumber,p.roomnumber); ach=p.ach; } int Inform::operator==(const Inform &t) { if((strcmp(number,t.number)==0)||(strcmp(name,t.name)==0)||(strcmp(id,t.id)==0) ||strcmp(phonenumber,t.phonenumber)||(strcmp(roomnumber,t.roomnumber)==0)) return 1; else return 0; } int Inform::operator==(char *s) { if( (strcmp(number,s)==0)||(strcmp(name,s)==0)||(strcmp(id,s)==0)|| (strcmp(roomnumber,s)==0)||(strcmp(phonenumber,s)==0)) return 1; else return 0; } int Inform::operator!=(char *t) { if( (strcmp(number,t)==0)||(strcmp(name,t)==0)||(strcmp(id,t)==0) ||(strcmp(phonenumber,t)==0)||(strcmp(roomnumber,t)==0)) return 0; else return 1; } Inform &Inform::operator=(Inform &a) { ach=a.ach; strcpy(id,a.id); strcpy(name,a.name); strcpy(number,a.number); strcpy(sex,a.sex); strcpy(phonenumber,a.phonenumber); strcpy(roomnumber,a.roomnumber); return *this; } Inform::~Inform() { delete [] number; 免责声明:文档在线网(文档中国)中所有的文档资料均由文档在线网会员提供。文档在线网会对会员提供的文档资料进行筛选和编辑,但是并不声明或保证其内容的合法性、正确性或可靠性。该文档资料的版权属于提供者所有,有关版权的问题请直接与提供者联系。 delete [] id; delete [] name; delete [] sex; delete [] phonenumber; delete [] roomnumber; } ************************achieve.h******************************************** *********** #ifndef achieve_h #define achieve_h #include"subject.h" class achieve{ friend ostream &operator<<(ostream &output,achieve &); friend istream &operator>>(istream &input,achieve &); public: achieve(); void countaverage(subject *); int operator==(achieve &); achieve &operator=(achieve &); void instruction(); ~achieve(); void setnum(int a); int getnum(); subject *TT; private: int num; float sum; float average; }; #endif ***************************** achieve.cpp******************************* #include"achieve.h" achieve::achieve() { TT=new subject[sizeof(subject)]; } void achieve::setnum(int a=0) { 免责声明:文档在线网(文档中国)中所有的文档资料均由文档在线网会员提供。文档在线网会对会员提供的文档资料进行筛选和编辑,但是并不声明或保证其内容的合法性、正确性或可靠性。该文档资料的版权属于提供者所有,有关版权的问题请直接与提供者联系。 num=a; } int achieve::getnum() { return num; } void achieve::countaverage(subject *t) { sum=average=0; float temp=0; for(int i=0;ixuefen; temp+=((t+i)->achievement)*((t+i)->xuefen); } average=temp/sum; } ostream &operator<<(ostream &output,achieve &t) { t.countaverage(t.TT); for(int i=0;i>(istream &input,achieve &t) { for(int i=0;i>t.TT[i]; return input; } int achieve::operator==(achieve &t) { if(average==t.average&&sum==t.sum&&TT==t.TT) return 1; else return 0; } achieve &achieve::operator =(achieve &t) { 免责声明:文档在线网(文档中国)中所有的文档资料均由文档在线网会员提供。文档在线网会对会员提供的文档资料进行筛选和编辑,但是并不声明或保证其内容的合法性、正确性或可靠性。该文档资料的版权属于提供者所有,有关版权的问题请直接与提供者联系。 average=t.average; sum=t.sum; for(int i=0;i #include #include #include #include #define MAX1 5 class subject{ friend istream &operator>>(istream &,subject &); friend ostream &operator<<(ostream &,const subject &); public: subject &operator=(const subject &); char name[MAX1]; float achievement; float xuefen; }; #endif *************************** subject.cpp*************************************** #include"subject.h" 免责声明:文档在线网(文档中国)中所有的文档资料均由文档在线网会员提供。文档在线网会对会员提 供的文档资料进行筛选和编辑,但是并不声明或保证其内容的合法性、正确性或可靠性。该文档资料的版 权属于提供者所有,有关版权的问题请直接与提供者联系。 istream &operator>>(istream &input,subject &T) { cout<>T.name; cout<<" 成绩: "; input>>T.achievement; cout<<" 学分: "; input>>T.xuefen; return input; } ostream &operator<<(ostream &output,const subject &T) { output< #include "listNode.h" #include "Inform.h" #include static char passwords[6]="82136"; void welcome();// void INSTRUCTION();//主界面函数; void main() { char pass[5]; do{ //clrscr(); welcome(); cin>>pass; 免责声明:文档在线网(文档中国)中所有的文档资料均由文档在线网会员提供。文档在线网会对会员提供的文档资料进行筛选和编辑,但是并不声明或保证其内容的合法性、正确性或可靠性。该文档资料的版权属于提供者所有,有关版权的问题请直接与提供者联系。 if(strcmp(pass,"E")==0) exit(1); }while(strcmp(pass,passwords)!=0); static listNode *head=new listNode[LEN]; INSTRUCTION(); head=head->create(); INSTRUCTION(); char ch,c; cin>>ch; while(1) { switch(ch) { case 'I': head=head->insert(head); break; case 'P': head->printlistNode(head); break; case 'D':{ cout<<"输入要删除的学生的一项资料(姓名,学号,身份证号,寝室号, 电话号码): "; char *deldata; deldata=new char[20]; cin>>deldata; head=head->del(head,deldata); break; } case 'S':{ char *search; search=new char[20]; cout<<"\t输入要查找的学生的姓名,学号,电话号码们寝室号或者身份证 号码:"<>search; head->search(search,head); break; } case 'M': head=head->modify(head); break; case 'E': exit(2); break; 免责声明:文档在线网(文档中国)中所有的文档资料均由文档在线网会员提供。文档在线网会对会员提 供的文档资料进行筛选和编辑,但是并不声明或保证其内容的合法性、正确性或可靠性。该文档资料的版 权属于提供者所有,有关版权的问题请直接与提供者联系。 default: cout<<"\t输入错误."<>c; INSTRUCTION(); cin>>ch; } } void INSTRUCTION() { cout<
/
本文档为【C++课程设计】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索