西北工业大学C++大作业第1题2016
- 格式:docx
- 大小:19.08 KB
- 文档页数:13
作业名称:学生通讯录管理系统
学院:自动化学院
班级:
学号:
姓名:
团队组成:
西北工业大学
2022年4月27日
请填写以下十项内容,将表格按页对齐(插入空行),勿删除任何部分。
1、问题与背景(描述程序所要解决的问题或应用背景)
2、开发工具(列出所使用的开发工具和第3方开发库)
3、主要功能(详细说明程序的功能)
4、设计内容(详细描述解决问题的原理和方法、算法、数据结构等)
5、程序文件与工程名称(标出程序中所有文件名、工程名称及其说明)
6、函数模块(程序中各个函数的原型声明及其说明)
7、使用说明(运行程序的小型说明书)
8、程序开发总结(简要叙述编写本作业的收获与思考)
9、运行截图(附上程序运行的截图画面,至少有1幅,截图越翔实得分越高)
增加联系人
修改联系人
删除联系人
按学生姓名查询联系人
按学生学号查询联系人
保存通讯录
打开通讯录
10、源程序(附上程序源代码,若是多个文件,标出文件名)
#include
#include
#include
#include
using namespace std;
static int n=0;
struct student{
string name;
string number;
string address;
string telephone;
string post;
string mail;
};
class information{
private:
student st[10];
public:
void add(string name, string number,string address,string telephone,string post,string mail);
void print(int i)
{
cout<<"\t\t姓名:"< cout<<"\t\t学号:"< cout<<"\t\t地址:"< cout<<"\t\t电话:"< cout<<"\t\t邮编:"< cout<<"\t\t邮箱:"< } void findname(string name); void findnumber(string number); void correct(string name); void del(string); void save(); void read(); }; void information::add(string name, string number,string address,string telephone,string post,string mail) { static int i=0; st[i].address=address; st[i].mail=mail; st[i].name=name; st[i].number=number; st[i].post=post; st[i].telephone=telephone; i++; n++; } void information::findname(string name) { int x=0; for(int i=0;i<10;i++) { if(st[i].name==name) { print(i); x=1; break; } } if(x==0) cout<<"the man can.t be found in the record!"< } void information::findnumber(string number) { for(int i=0;i<10;i++) { if(st[i].number==number) { print(i); x=1; break; } } if(x==0) cout<<"the student can.t be found in the record!"< void information::correct(string name) { string number; string address; string telephone; string post; string mail; int x=0; for(int i=0;i<10;i++) { if(st[i].name==name) { cout<<"\t输入要修改的姓名:"; cin>>name; st[i].name=name; cout<<"\t输入要修改的学号:"; cin>>number; st[i].number=number; cout<<"\t输入要修改的地址:"; cin>>address; st[i].address=address; cout<<"\t输入要修改的电话:"; cin>>telephone; st[i].telephone=telephone; cout<<"\t输入要修改的邮编:"; cin>>post; st[i].post=post; cout<<"\t输入要修改的邮箱:"; cin>>mail; st[i].mail=mail; print(i); x=1;