《程序设计实践》课程报告.docx

上传人:b****5 文档编号:7262542 上传时间:2023-05-11 格式:DOCX 页数:34 大小:642.74KB
下载 相关 举报
《程序设计实践》课程报告.docx_第1页
第1页 / 共34页
《程序设计实践》课程报告.docx_第2页
第2页 / 共34页
《程序设计实践》课程报告.docx_第3页
第3页 / 共34页
《程序设计实践》课程报告.docx_第4页
第4页 / 共34页
《程序设计实践》课程报告.docx_第5页
第5页 / 共34页
《程序设计实践》课程报告.docx_第6页
第6页 / 共34页
《程序设计实践》课程报告.docx_第7页
第7页 / 共34页
《程序设计实践》课程报告.docx_第8页
第8页 / 共34页
《程序设计实践》课程报告.docx_第9页
第9页 / 共34页
《程序设计实践》课程报告.docx_第10页
第10页 / 共34页
《程序设计实践》课程报告.docx_第11页
第11页 / 共34页
《程序设计实践》课程报告.docx_第12页
第12页 / 共34页
《程序设计实践》课程报告.docx_第13页
第13页 / 共34页
《程序设计实践》课程报告.docx_第14页
第14页 / 共34页
《程序设计实践》课程报告.docx_第15页
第15页 / 共34页
《程序设计实践》课程报告.docx_第16页
第16页 / 共34页
《程序设计实践》课程报告.docx_第17页
第17页 / 共34页
《程序设计实践》课程报告.docx_第18页
第18页 / 共34页
《程序设计实践》课程报告.docx_第19页
第19页 / 共34页
《程序设计实践》课程报告.docx_第20页
第20页 / 共34页
亲,该文档总共34页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

《程序设计实践》课程报告.docx

《《程序设计实践》课程报告.docx》由会员分享,可在线阅读,更多相关《《程序设计实践》课程报告.docx(34页珍藏版)》请在冰点文库上搜索。

《程序设计实践》课程报告.docx

《程序设计实践》课程报告

 

课程名称:

程序设计实践

专业班级:

学生姓名:

学号:

任课教师:

学期:

 

课程报告任务书

题目

通讯录管理系统

主要

内容

开发一个模拟手机通讯录管理软件,联系人信息主要包括:

姓名、性别、电话号码、总通信次数、QQ号码、微信号码、电子邮件、生日等信息。

(也可以根据自己情况进行扩充),也可以进一步地将联系人划分为所属组名称:

比如同事,同学,朋友,亲人等)。

通信次数(包括语音通话、短信、邮件等的通信的计次总次数),使之有基本功能:

(1)联系人信息录入功能(数据信息用文件保存)

(2)联系人信息的浏览功能(浏览的方式可以自行决定)(3)查询功能(至少一种查询方式)、排序功能(至少一种排序方式):

①按姓名查询②按号码查询

按照姓名排序

按年龄排序等或通信次排序(4)联系人信息的删除与修改

扩展功能:

比如

(1)简单的权限处理

(2)报表打印功能(3)联系人分组的功能,可以进一步扩充,比如新建分组、修改分组名称,批量移动信息人,如QQ分组功能。

(4)查询:

比如按拼音首字符查询或者按全拼查询(5)按照部分号码查询(6)备份数据功能等;(7)根据联系人信息中的总通信次数可以进行排序,总之,可以根据自己需求进行分析功能。

任务

要求

一、提交材料应包括:

(1)系统源代码

(2)课程报告

二、整个设计过程具体要求

(1)需求分析要求学生对案例系统进行分析,设计出需要完成的功能,完善各个模块的调用关系;

(2)设计过程要求学生进一步明确各模块调用关系,进一步完善模块函数细节(函数名、参数、返回值等)

(3)实现过程要求学生养成良好的编码习惯、完成各个模块并进行测试,最终完成系统整体测试;

(4)总结阶段按照要求完成系统设计和实现报告,并进行总结、答辩。

成绩

评定

报告撰写情况(30分)

系统完成情况(30分)

答辩情况(40分)

总分

内容

20分

规范程度

5分

程序测试

5分

基本功能20分

扩展功能10分

自述情况10分

答辩情况

30分

成绩评定教师:

1需求分析

1.1.开发一个一个手机通讯录,用于记录联系人的姓名,年龄,性别,手机号码,QQ号码,家庭住址,,以及电子邮件。

1.2.满足用户对通讯录的基本操作:

新建,删除,修改,排序,查找,浏览,以及文件的读与写,扫描已有文件中的联系人资料。

新建:

用户可以添加多个联系人。

并进行按照名字排序。

删除:

满足用户按照名字对联系人进行删除操作。

修改:

满足用户对联系人的信息进行修改。

排序:

实现联系人按照名字和号码进行排序。

查找:

满足用户对联系人进行查找,对名字、号码和QQ号码进行查找处理。

浏览:

输出所有人的信息。

文件的读与写:

对联系人的保存与读。

2概要设计(小三黑体)

2.1模块概要

2.1.1定义变量——结构体

structfriends_list{//储存联系人信息

charname[20];//姓名

charage[5];//年龄

charsex[3];//性别

charphonenumber[15];//电话号码

charQQnumber[12];//QQ号码

charaddress[80];//地址

charnum[500];//编号

charmail[40];//电子邮箱

structfriends_list*next;

};

2.1.2自定义函数

structfriends_list*load_friend(structfriends_list*head);//从文件中读取联系人

voidsave_friend(structfriends_list*head);//保存联系人

structfriends_list*Create_Lianxi_Doc(structfriends_list*head);//新建联系人

structfriends_list*Delete(structfriends_list*head,char*name);//删除联系人

structfriends_list*xiugai(structfriends_list*head,char*name);//修改联系人

structfriends_list*sort_friend(structfriends_list*head,char*name);//排序

voidPrint_friends_Doc(structfriends_list*head);//查看所有联系人

voidsearch_friend1(structfriends_list*head,char*name);//按姓名对联系人进行查找

voidsearch_friend2(structfriends_list*head,char*phonenum);//按电话号码对联系人进行查找

voidsearch_friend3(structfriends_list*head,char*QQnumber);//按QQ号码对联系人进行查找

structfriends_list*scanf_friend();//扫描文件

2.1.3流程图与模块图

图1.1

2.1.4自定义模块

2.1.4.1新建联系人

此模块为联系人的新建,用户在提醒语句的提示下依次输入新建联系人的信息,并且在用户输入最后一条信息后回车结束新建,系统自动返回主菜单参数为head,返回值为head。

2.1.4.2读取文件中已有联系人

此模块主要用于用户浏览已有联系人的信息,参数为head,返回值为head。

2.1.4.3删除联系人

用户通过输入所要删除的联系人姓名进行删除操作,执行此操作时,用户将删除所输入联系人的所有信息,参数为head、name,返回值为head。

2.1.4.4修改联系人

调用此模块时,用户将首先输入想要修改的联系人姓名,之后将进一步选择所要修改的信息选项,当用户将所有要修改的信息修改完成后可选择0退出修改操作并返回主菜单;参数为head、name,返回值为head;

2.1.4.5浏览联系人

对于已保存的联系人信息(或文件中已存在的联系人信息)可选择此操作进行遍历操作,参数为head,无返回值;

2.1.4.6保存

用户在完成联系人的新建后,可选择此操作进行保存处理,保存的联系人信息将写入文件中(若文件不为空择将在文件中续写),参数为head,无返回值;

2.1.4.7联系人排序

此操作可将联系人按照姓名进行重新排序,参数为head、name,返回值为head;

2.1.4.8查找联系人

在选择此操作的时候,用户将进入查找方式的选择界面,通过输入序号进行选择查找方式,此操作共有三种搜索方式供用户选择———1姓名2电话3QQ号码,参数为head,无返回值。

3详细设计

#include

#include

#include

structfriends_list{//储存联系人信息

charname[20];//姓名

charage[5];//年龄

charsex[3];//性别

charphonenumber[15];//电话号码

charQQnumber[12];//QQ号码

charaddress[80];//地址

charnum[500];//编号

charmail[40];//电子邮箱

structfriends_list*next;

};

intCount=0;//全局变量储存联系人个数

intsystem(constchar*string);

structfriends_list*load_friend(structfriends_list*head);//从文件中读取联系人

voidsave_friend(structfriends_list*head);//保存联系人

structfriends_list*Create_Lianxi_Doc(structfriends_list*head);//新建联系人

structfriends_list*Delete(structfriends_list*head,char*name);//删除联系人

structfriends_list*xiugai(structfriends_list*head,char*name);//修改联系人

structfriends_list*sort_friend(structfriends_list*head,char*name);//排序

voidPrint_friends_Doc(structfriends_list*head);//查看所有联系人

voidsearch_friend1(structfriends_list*head,char*name);//按姓名对联系人进行查找

voidsearch_friend2(structfriends_list*head,char*phonenum);//按电话号码对联系人进行查找

voidsearch_friend3(structfriends_list*head,char*QQnumber);//按QQ号码对联系人进行查找

structfriends_list*scanf_friend();

==============主函数========================

intmain(void)//主函数

{

structfriends_list*head;

charchoice;

intchoices;

charname[20];/*姓名*/

charphonenum[15];

charQQnumber[13];

head=NULL;

head=scanf_friend();

do{

printf("\t\t\t〓〓〓欢迎进入通讯录〓〓〓\n");

printf("\t\t\t\t◆1.新建◆\n");

printf("\t\t\t\t◆2.读取◆\n");

printf("\t\t\t\t◆3.删除◆\n");

printf("\t\t\t\t◆4.修改◆\n");

printf("\t\t\t\t◆5.浏览◆\n");

printf("\t\t\t\t◆6.保存◆\n");

printf("\t\t\t\t◆7.排序◆\n");

printf("\t\t\t\t◆8.查找◆\n");

printf("\t\t\t\t◆0.退出◆\n");

printf("\t\t\t〓〓〓〓〓〓〓〓〓〓〓〓〓\n");

scanf("%c",&choice);

getchar();

while(choice<'0'||choice>'8')

{

printf("\n对不起,您输入有误!

请重新输入!

\n");

scanf("%c",&choice);

getchar();

}

switch(choice){

case'1':

head=Create_Lianxi_Doc(head);

break;

case'2':

head=load_friend(head);

break;

case'3':

printf("请输入您要删除的联系人姓名:

\n");

gets(name);

head=Delete(head,name);

break;

case'4':

printf("请您输入要修改的联系人的名字:

");

gets(name);

while(strlen(name)==0)

{

gets(name);

}

head=xiugai(head,name);

break;

case'5':

Print_friends_Doc(head);

break;

case'6':

save_friend(head);

break;

case'7':

head=sort_friend(head,name);

break;

case'8':

printf("请选择您的查询方式:

\n");

printf("1.按姓名对联系人进行查找\n");

printf("2.按电话号码对联系人进行查找\n");

printf("3.按QQ号码对联系人进行查找\n");

scanf("%d",&choices);

while(choices<1||choices>3)

{

if(choices=='\n')

printf("对不起,您输入有误!

\n");

scanf("%d",&choices);

}

switch(choices)

{

case1:

printf("请输入您要查询的联系人姓名:

");

getchar();

gets(name);

search_friend1(head,name);

break;

case2:

printf("请输入您要查询的联系人电话号码:

");

getchar();

gets(phonenum);

search_friend2(head,phonenum);

break;

case3:

printf("请输入您要查询的联系人QQ号码:

");

getchar();

gets(QQnumber);

search_friend3(head,QQnumber);

break;

}

break;

case'0':

break;

}

}

while(choice!

='0');

return0;

}

新建联系人

structfriends_list*Create_Lianxi_Doc(structfriends_list*head)

{

structfriends_list*p,*tail;

charname[20];//姓名

charage[5];//年龄

charsex[5];//性别

charphonenumber[15];//电话

charQQnumber[12];//QQ号码

charaddress[80];//地址

charmail[40];//电子邮箱

intflag=0;

if(Count==100)//判断通讯录是否已已满

{

printf("通讯录已满!

\n");

return0;

}

if(head!

=NULL)//判断链表是否为空

{

for(p=head;p;p=p->next)

{

tail=p;

}

}

p=NULL;

p=(structfriends_list*)malloc(sizeof(structfriends_list));//申请变量空间

printf("请输入新的联系人姓名:

");

gets(name);

if(strlen(name)==0)

{

printf("对不起,联系人姓名不能为空!

\n");

gets(name);

}

strcpy(p->name,name);

printf("请输入新建联系人年龄:

");

gets(age);

strcpy(p->age,age);

printf("请输入新建联系人性别:

");

gets(sex);

strcpy(p->sex,sex);

printf("请输入新建联系人号码:

");

gets(phonenumber);

strcpy(p->phonenumber,phonenumber);

printf("请输入新建联系人QQ号码:

");

gets(QQnumber);

strcpy(p->QQnumber,QQnumber);

printf("请输入新建联系人的住址:

");

gets(address);

strcpy(p->address,address);

printf("请输入新建联系人电子邮箱:

");

gets(mail);

strcpy(p->mail,mail);

p->next=NULL;

if(head==NULL)

{

head=p;

}

else

tail->next=p;

Count++;

printf("新联系人创建成功!

");

returnhead;

}

读取文件中已存联系人

structfriends_list*load_friend(structfriends_list*head)

{

FILE*fp;

charname[20];/*姓名*/

charage[5];/*年龄*/

charsex[3];/*性别*/

charphonenumber[15];

charQQnumber[12];

charaddress[80];

charmail[40];

if((fp=fopen("通讯录.txt","r"))==NULL)

{

printf("Cannotopenfilestrikeanykeyexit!

\n");

exit(0);

}

while(!

feof(fp))

{

fscanf(fp,"%s\n",name);

printf("姓名:

");

printf("%-10s\n",name);

fscanf(fp,"%s\n",age);

printf("年龄:

");

printf("%-10s\n",age);

fscanf(fp,"%s\n",sex);

printf("性别:

");

printf("%-10s\n",sex);

fscanf(fp,"%s\n",phonenumber);

printf("电话:

");

printf("%-10s\n",phonenumber);

fscanf(fp,"%s\n",QQnumber);

printf("QQ号码:

");

printf("%-10s\n",QQnumber);

fscanf(fp,"%s\n",address);

printf("住址:

");

printf("%-10s\n",address);

fscanf(fp,"%s\n",mail);

printf("电子邮箱:

");

printf("%-10s\n",mail);

}

if(fclose(fp))

{

printf("Cannotclosethisfile!

\n");

exit(0);

}

returnhead;

printf("\n读入文件成功!

\n");

}

删除联系人

structfriends_list*Delete(structfriends_list*head,char*name)

{

structfriends_list*ptr1,*ptr2;

while(head!

=NULL&&strcmp(head->name,name)==0)

{

ptr2=head;

head=head->next;

free(ptr2);

}

if(head==NULL)

returnNULL;

ptr1=head;

ptr2=head->next;//从头开始搜索符合要求的结点

while(ptr2!

=NULL){

if(strcmp(ptr2->name,name)==0){

ptr1->next=ptr2->next;

free(ptr2);//释放空间

}

else

ptr1=ptr2;

ptr2=ptr1->next;

}

printf("删除成功!

");

returnhead;

}

修改联系人信息

structfriends_list*xiugai(structfriends_list*head,char*name)

{

structfriends_list*p;

charage[5];//年龄

charsex[3];//性别

charphonenumber[15];//电话号码

charQQnumber[12];//QQ号码

charaddress[80];//地址

charmail[40];//电子邮箱

intchoice;

intflag=0;

if(Count==0)//判断通讯录是否为空

{

printf("通讯录无记录!

无法进行操作!

");

returnhead;

}

for(p=head;p;p=p->next)

{

if(strcmp(name,p->name)==0)

{

do{

printf("请选择您要修改的内容:

\n");

printf("1.姓名\n");

printf("2.年龄\n");

printf("3.性别\n");

printf("4.电话\n");

printf("5.QQ号码\n");

printf("6.家庭住址\n");

printf("7.电子邮箱\n");

printf("0.退出\n");

scanf("%d",&choice);

getchar();

switch(choice)//选择修改内容

{

case1:

printf("请输入姓名:

");

gets(name);

strcpy(p->name,name);

break;

case2:

printf("请输入年龄:

");

gets(age);

strcpy(p->age,age);

break;

case3:

printf("请输入性别:

");

gets(sex);

strcpy(p->sex,sex);

break;

case4:

printf("请输入电话:

");

gets(phonenumber);

strcpy(p->phonenumber,phonenumber);

break;

case5:

prin

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 经管营销 > 经济市场

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2