C++通讯功能管理系统课程设计.docx
- 文档编号:6888942
- 上传时间:2023-01-12
- 格式:DOCX
- 页数:15
- 大小:17.06KB
C++通讯功能管理系统课程设计.docx
《C++通讯功能管理系统课程设计.docx》由会员分享,可在线阅读,更多相关《C++通讯功能管理系统课程设计.docx(15页珍藏版)》请在冰豆网上搜索。
C++通讯功能管理系统课程设计
C++通讯功能管理系统课程设计
Main.cpp
#include"zql2107.h"
#include"zql2107.cpp"
intmain()
{
main_view();
return0;
}
Zql2107.cpp
#include"zql2107.h"
structinformation
{
personspe;
structinformation*next;
}*file_1,*file_2,*file_3;
structinformation1
{
intfile_position;
personspe;
structinformation1*next;
}*information_node=NULL;
voidmain_view(void)
{
for(intj=0;j<3;j++)
{
cout<<"loading........"< cout<<""; for(inti=0;i<57;i++) { Sleep(50); cout<<'>'; } system("cls"); } cout<<"**************************"< cout<<"1、查询功能"< cout<<"2、修改功能"< cout<<"3、增加功能"< cout<<"请输入相应的信息来操作"< select_function(); } voidselect_function(void) { intselect_number; cin>>select_number; switch(select_number) { case1: system("cls"); browse(); submenu(); break; case2: system("cls");change_information();submenu();break; case3: system("cls");add_information();submenu();break; default: system("cls"); main_view(); } } voidsubmenu(void) { system("cls"); cout<<"1、continue2、exit"< cout< intselect_number; cin>>select_number; cin.sync(); switch(select_number) { case1: system("cls"); main_view(); break; case2: default: exit(0); } } voidbrowse(void) { cout<<"你想要浏览的类别是什么? "< cout< intselect_number; cin>>select_number; classpersonspe; pe.data_output(select_number); } voidadd_information(void) { cout<<"(输入\'#\'结束)"; structinformation1*enter_link=newstructinformation1; information_node=enter_link; information_node->next=NULL; structinformation1*enter_link1=enter_link; charch; intrecourd=1; stringreal_name; cin.get(ch); while(ch! ='#') { enter_link->next=newstructinformation1; real_name=enter_link->next->pe.enter_data(); while((enter_link1! =enter_link->next)&&enter_link1! =NULL) { if(enter_link1->pe.return_name()==real_name) { recourd=0;break; } else enter_link1=enter_link1->next; } if(recourd==0) { cout<<"errorforreenter"< recourd=1; enter_link1=information_node; continue; } else { cout<<"1、商务类2、个人类3、办公类"< cin>>enter_link->next->file_position; cin.sync(); enter_link=enter_link->next; cout< cin.get(ch); } }enter_link->next=NULL; save_input_information(); } voidsave_input_information(void) { structinformation1*auxiliary_pointer=information_node->next; while(auxiliary_pointer! =NULL) { auxiliary_pointer->pe.enter_file(auxiliary_pointer->file_position); auxiliary_pointer=auxiliary_pointer->next; } } voidchange_information(void) { cout<<"你想要浏览的类别是什么? "< cout< intselect_number; cin>>select_number; switch(select_number) { case1: system("cls"); file_class_1(); lookfor_file(file_1);save_to_file (1); system("cls"); submenu();break; case2: system("cls"); file_class_2(); lookfor_file(file_2);save_to_file (2); system("cls"); submenu();break; case3: system("cls"); file_class_3(); lookfor_file(file_3);save_to_file (2); submenu();break; default: system("cls"); change_information(); } } voidlookfor_file(structinformation*file_1_2_3)//到从一类文件中查找某人 { cout<<"请输入您要查询的名字"< stringlookfor_name; cin>>lookfor_name; structinformation*file_pointer=file_1_2_3; while(file_pointer->next! =NULL) { if(file_pointer->next->pe.return_name()==lookfor_name) { file_pointer->next->pe.print_information(); cout<<"你想修改信息还是删除信息? "< cout<<"1、修改2、删除"< intselect_number; cin>>select_number; switch(select_number) { case1: file_pointer->next->pe.enter_data();break; case2: file_pointer->next=file_pointer->next->next;break; } break; } else file_pointer=file_pointer->next; }} voidvist(void) { structinformation*visit_pointer=file_1; while(visit_pointer->next! =NULL) { cout<<"o----"; visit_pointer->next->pe.print_information(); cout<<"______"; visit_pointer=visit_pointer->next; } } voidfile_class_1(void)//从commerce中输入所有的数据 { ifstreaminfile("commerce.txt"); file_1=newstructinformation; structinformation*class_pointer=file_1; stringstr,str1,str2,str3; stringstreamstrstream; while(getline(infile,str)) { class_pointer->next=newstructinformation; strstream< strstream>>str1>>str2>>str3; strstream.clear(); class_pointer->next->pe.enter_outer_data(str1,str2,str3); class_pointer=class_pointer->next; } class_pointer->next=NULL; infile.close(); cout<<"ok"< vist(); } voidfile_class_2(void)//从personal中输入所有的数据 { ifstreaminfile("personal.txt"); file_2=newstructinformation; structinformation*class_pointer=file_2; stringstr,str1,str2,str3; stringstreamstrstream; while(getline(infile,str)) { class_pointer->next=newstructinformation; strstream< strstream>>str1>>str2>>str3; strstream.clear(); class_pointer->next->pe.enter_outer_data(str1,str2,str3); class_pointer=class_pointer->next; } class_pointer->next=NULL; infile.close(); } voidfile_class_3(void)//从office中输入所有的数据 { ifstreaminfile("office.txt"); file_3=newstructinformation; structinformation*class_pointer=file_3; stringstr,str1,str2,str3; stringstreamstrstream; while(getline(infile,str)) { class_pointer->next=newstructinformation; strstream< strstream>>str1>>str2>>str3; class_pointer->next->pe.enter_outer_data(str1,str2,str3); class_pointer=class_pointer->next; } class_pointer->next=NULL; infile.close(); } voidsave_to_file(intsave_number) { if(save_number==1) { system("delcommerce.txt"); structinformation*class_pointer=file_1->next; while(class_pointer! =NULL) { class_pointer->pe.enter_file (1); class_pointer=class_pointer->next; } } elseif(save_number==2) { system("delpersonal.txt"); structinformation*class_pointer1=file_2->next; while(class_pointer1! =NULL) { class_pointer1->pe.enter_file (2); class_pointer1=class_pointer1->next; } } else { system("deloffice.txt"); structinformation*class_pointer2=file_3->next; while(class_pointer2 ! =NULL) { class_pointer2->pe.enter_file(3); class_pointer2=class_pointer2->next; } } } Zql2107.h #ifndefZQL2107_H_INCLUDED #defineZQL2107_H_INCLUDED #include #include #include #include #include #include usingnamespacestd; voidfile_class_1(void); voidfile_class_2(void); voidfile_class_3(void); voidlook_information(void); voidlookfor_file(structinformation*); voidview_menu(void); voidenter_to_file1(void); voidenter_to_file2(void); voidenter_to_file3(void); voidsave_to_file(intsave_number); voidselect_function(void); voidmain_view(void); voidbrowse(void); voidsubmenu(void); voidchange_information(void); voidadd_information(void); voidsave_input_information(void); classpersons { public: stringenter_data(void);//输入一个结点信息。 voidprint_information(void);//输出一个结点信息。 voidread_information(intfile_number);//读一个文件类中的所有的数据。 voidenter_outer_data(stringstr1,stringstr2,stringstr3); voiddata_enter_file(void); voidenter_file(int); voiddata_output(int); stringreturn_name(void)//返回一个名字; { returnname; } stringreturn_tel(void)//返回一个电话; { returntel; } private: stringname; stringtel; stringmailbox; }; voidpersons: : enter_outer_data(stringstr1,stringstr2,stringstr3)//通过外来变量给name、tel、mailbox、赋值 { name=str1;tel=str2;mailbox=str3; } voidpersons: : print_information(void)//输出nametelmailbox { cout<<"personsinformation"< cout<<"name: "< cout<<"tel: "< cout<<"mailbox: "< } voidpersons: : read_information(intfile_number)//从相应的文件中读出所有的数据 { fstreaminfile; if(file_number==1) infile.open("commerce.dat"); else if(file_number==2) infile.open("personal.dat"); else infile.open("office.dat"); stringstreamstrstream; stringstr; while(getline(infile,str)) { strstream< strstream>>name>>tel>>mailbox; print_information(); } infile.close(); } voidpersons: : data_enter_file(void) { cout<<"请输入相应的个人信息: "< cout<<"name: "; cin>>name; cin.sync(); cout<<"tel: "; cin>>tel; cin.sync(); cout<<"mailbox: "; cin>>mailbox; cin.sync(); cout<<"option: 1、商务类2、个人类3、办公类"< cout<<"select: "; inti; cin>>i; ofstreamoutfile; switch(i) { case1: outfile.open("commerce.txt",ios: : app|ios: : out);break; case2: outfile.open("personal.txt",ios: : app|ios: : out);break; case3: outfile.open("office.txt",ios: : app|ios: : out);break; default: exit(0); } outfile< outfile.close(); } voidpersons: : data_output(intfile_serial_number) { system("cls"); cout<<"************Information***********************************"< fstreaminfile; switch(file_serial_number) { case1: infile.open("commerce.txt");break; case2: infile.open("personal.txt");break; case3: infile.open("office.txt");break; default: exit(0); } stringstr; stringstreamstrstream; while(getline(infile,str)) { strstream< strstream>>name>>tel>>mailbox; strstream.clear(); cout<<"name: "< "< "< } system("pause"); infile.close(); } //已用到的函数 stringpersons: : enter_data(void)//内部给、nametelmailbox赋值 { cout<<"请在下面输入对应的信息: "< cout<<"name: ";cin>>name; cout<<"tel: ";cin>>tel; cout<<"mailbox: ";cin>>mailbox; returnname; } voidpersons: : enter_file(intselect_number) { ofstreamoutfile; switch(select_number) { case1: outfile.op
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- C+ 通讯 功能 管理 系统 课程设计