版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、c语言课程设计题目名称:杂志订阅管理软件设计姓名:学号:班级序号:指导老师:目录9#rj> rj> rj> rjw rj> rj> rjw rj> rj> rj> rj> rj> rj> rj> rj> rjw rj> rj> rjw rjw rj> rjw rj rj> rj> rj> rj> rj> rjw rj rj> rjw rjw rj> rj> r|> rj> rj rj> rj> rj> rj> rj&
2、gt; j设计思路及要求< «k2 <*> <fe <r<f#<> <> «kf» kekj> «kf» ekf>ekj><x> <x><jw rjw rfe rfe rj> rfe rferj> rj> rfe rj>rj> ej> rfe e|> e|> ej> ej> e|>ej> ej> e|><jw ej> e|><jw
3、ej> e|>e|> e|>1程序设计思路<2 <2 2 <2rj>rjw rj> rjw r|> rj> <jwrj> rj> rj> rj>rj> ejw rjw §2.程序设计要求k*> k> 2>><> k> <f><> %f> <> >k> %t>rj jw rj rj jw rj rj jwrjrj rj ej> rj r| rj rj rj r| rj r|>
4、; k程序总体设计流程图%*>*>0rjw rjw rj> rjw rjwrj功能模块的调试和测试rj> rjw rj> rj> rw rj> . rw . ejw rw rw rjw rw rw rjw rjw . rjw rjw . rj> rw . ejw1增加订户模块弘弘 <t> % %弘%2#2#<2 <2 <£> <2 弘弘rjw rjw rj> rjw rjwrj> rjw rjw rjw rjw rjwrjw rjw rjwrjw rjw rjwrjw rjw rjw
5、 rjw rjw rjw rjw rjwrjw rjw rjw2.删除过期订户弘<x><1#3> %rj> rj> rjw rj> rj> rjw rj> rj> rj> rj> rjw rj> rj>rj> rjwrj> rjw rjw rj> rjw rjw rj> rj> rjw rj> rj>3.输出所有信息kj><j> kj>“ <j><s> <s> *j> <s> kj>k|
6、> <j><s> *j> *j> <s>s> %<£>kj>1、rjw rj><j> 卜rj> rj> rye rj> rj> rjrjw rjwej rjw rye rjw rjwrj> rj rjwrjw rjrjw rj>jk4.统计本月订户kj><j> k> “ <j> kj> kj> <?> <s> *j> <s> kj>k*>% j>
7、<£><s> s> k*> <> <j> <s> <j> 、rj> rjw卜rj> rjw rj* rjw rjw rye rj> rj ej rjw ry> rye rj> rj> rj* rj> rjw rj rjw rj> 0.5.查询用户<22#<f#<*# <> <> <*# <><f# <f#<*#rj> rjwrjw rj> rj> rjw rj
8、> rjwrjw rj> rjw rj> rj> r|> rjw rj> e|>rjw rj> rj> rjw rj>ej> rjw rj> rj> rj> rj>rjw rjw rj> rjw10程序设计的原代码弘 kj>«a» eit> «k» «k» 弘 <s 弘% % <s<s> <2kj> 弘rjw rjw rjw rjwrjwrjw rjw rjw rjw rjw rjw rjw
9、rjw rjw rjw rjw rj> rjw rjw rj> rjw rjw rjw rjw11c语言是一种计算机程序设计语言。它既有高级语言的特点,乂具有汇编 语言的特点。它可以作为系统设计语言,编写工作系统应用程序,也可以作为应 用程序设计语言,编写不依赖计算机硕件的应用程序。c语言是一种结构化语 言。它层次清晰,便于按模块化方式组织程序,易于调试和维护。c语言的 表现能力和处理能力极强。它不仅具冇丰富的运算符和数据类型,便于实 现各类复杂的数据结构。它还可以直接访问内存的物理地址,进行位(bit) 一级的操作。因此,它的应用范围广泛。c语言在很多方面都可以用,不仅 仅是在软
10、件开发上,各类科研都是需要用到c语言的。具体应用比如我是 学硕件的,单片机以及嵌入式系统都可以用c来开发。c语言发展如此迅 速,而且成为最受欢迎的语言之一,主要因为它具右强大的功能。许多著名 的系统软件,如dbase iii plus、dbase iv都是由c语言编写的。用c语 言加上一些汇编语言子程序,就更能显示c语言的优势了,像pc- dos、 wordstar等就是用这种方法编写的。在信息化迅速更新的今天,计算机已 经普及,而c语言为计算机的更新换代捉供了很好的基础平台,作为当代 的大学生学好c语言是很重要的。为此学校为我们提供了提高c语言专业 知识的载体,为我们开设了c语言上机实习课程
11、。设计思路及要求程序设计思路c语言程序设计主要是利用c语言的设计操作能力设计出一个杂志订阅管理系统,一个完整的杂志订阅管理软件至少应该具有:(1) 能够提供文件的储存、输入、输出、删除等操作;(2) 能够提供文件的添加操作,增加新用户等操作;(3) 能够提供文件的查询,查找等操作;(4) 能够通过文件的删除操作纪实删除已到期的订户记录;(5) 能够提供统计和显示操作统计木期杂志木期用户数并打卬运算结果;(6) 另外文件还要具备提供键盘式选择菜单以实现功能选择.程序设计要求c语言程序的设计需耍明确课程设计的口的,能根据课程设计的要求,查阅 相关文献,为完成设计准备必要的知识,提高学生用高级语言进
12、行程序设计的能 力,重点捉高用c语言进行文件操作和绘图应用的编程技术水平,并能够初步了解软件开发的-般方法和步骤,提高撰写技术文档的能力。而对于木次程序设计的耍求则是:使用计算机对一种朵志的订阅进行管理,该朵 志拥冇的最多用户不能超过10人,每个订户的信息包括:姓名,性别,地址, 电话号码,朵志单价,订阅数,订阅的期限(至*年*月)。要求用菜单选择并完成下述功能:(1)增加新用户,即将订户的全部信息输入的文件中;(2)根据当天的日期对订户文件进行查询,删除已到期的订户记录:(3)统计本期杂志订户数并打印运算结呆:木期订户信息表订户名订阅数单价金额李平25. 511. 0黄海15. 55. 5合
13、计31. 016. 5程序总体设计流程图功能模块的调试和测试add a new reader,press1.wannawannaupdate the message table .press2.wannaoutput all the message .press3.wannadisplay readers this month. .press4wanna exitpress1增加订户模块日臓眾1input start.八_八pleaseinpu tthename:八_八izhangsanplease femaleinpu tthesexnale/£emale:入pleaseinpu
14、tthediainunber:人_人87592291pleaseinpu tthecount二人_八please8pleaseinpu ttheprice:人_人inpu tthedate:八_八2008912the format is not right or the date is not existed.you should input the date like this ,vvvv.mm.dd,please input the date again:八_八 2008.09.12please input the address of reader: 八_八cugvou haue suc
15、cessfully add a reader?wanna check message .press0.1.wanna add a new reader .press2.删除过期订户揺文件舸钿-然件中tow綢2please input the current date:八_八 2008.08.08vou have successfully update the list?在上图屮我假设当前时间为20080808对文件中订户信息进行更新。下面来看看保存有订户信息的文本文件屮的数据情况。t isg -记事本文件g)编辑g)格式)查看)帮助qdnullnullnull00.000.009999.99.
16、99nullnullnullnull00.000.009999.99.99nullnullnullnull00.009999.99.99nullxiaomale8759229178.0056.002008.12.21bustzhanqsanfemale8759229178.0056.002008.09.12cug在上图屮我们可以看出所有的到期时间在20080808之前的订户的信息都被 段特殊的信息所代替。3. 输出所有信息打开文件关闭文件readernamei readeraddressreadsexnumbercoun tpricexiaomale8759229178.0056.002008
17、.12.21mstzhangsanfenale8759229178.0056.002008.09.12:ugbe ji140.000.00?:!/ou have successfully output the list?在上图中我输出了在msg. txt中的所有订户的信息。4. 统计本月订户4please input the month you wanna display:八_八2008:.08.08xiaonale8759229178.00000056.0000002008.12.21bustzhangsanfemale8759229178.000000560000002008.09.12c
18、ugvouhave successfully all thereaders thisnonth?上图中假设这个月是20080808o注意这个功能与删除过期订户的并界,统计功能只是输出文件中没有过期的订 户,而没有在文件中将过期的订户删除,而删除过期订户在文件中将过期的订户 删除。5. 查询用户不是遇到结束符号0please input the name you wanna index:八_八xiaothe reader you are checking is existed in the list xiao nale8759229178.00000056.0000002008.12.21 hu
19、st|¥ou haue successfully index the reader?|以上是查询姓名是,zxiao,z的订户的信息。程序设计的原代码iiinclude "stdio. h #inelude "string. h itinclude stdlib. h typedef struct msg char name20; char sex10; char dialnumber11; int count; float price; float money; char date20; char readeraddr50;jmsgnodc;void start
20、() printf ( i 1tx 1 ijwriten by david x. il of cugdavid x.h. all rights reservedprintf (* *n");printf (* *n);pri ntf (*n);pr intf c*n);甘.ni | jii ri ijvoid textout () printf (t'twanna check message, press0. nn);printf (ttwanna add a new reader, press1. nn);printf(t'twarma updatc the mes
21、sage table,press2.nrt);printf (/zttwanna output all the message , press3. nn);printf (zzttwanna display readers this month. , press4. nn);printf (z/ttwarma exit, press5. nn); int checkdatemon(char * date) char chdate3;chdate0=date5; chdatel=date6;chdate 2=' 0' return atoi(chdate);int chcckda
22、tcday(char * date) char chdate3; chdate0=date8; chdate1=date9; chdate2=,0' return atoi (chdatc);int addreader () file *fp;msgnode ad;辻(fp=fopen(zzmsg. txt", "at")二二null) printf (zzcannot open the file or cannot find the file, please check out n);getch();return 0;printf (zzinput st
23、art. t n); printf (z/please input the name: n);seanfad. name);printf ("please input the scxmalc/fcmalc: 二 n); scanfad. sex);printf ("please input the dialnumber:n);scanf (s,ad. dialnumber);printf ("please input the count: t n); seanf (d, &ad. count);printf c'please input the p
24、rice:八 n); scanf&ad price);printf (z/please input the date: n);scanf (s, ad. date);while (ad. date 4 !='. '| | ad. date 7 !='. '| | strlcn (ad. date) !=10icheckdatemon(ad. date)>=13|checkdateday (ad.date)>=32) printf (/zthe format is not right or the date is not existech n
25、“); printf(you should input the date like this ' yyyy. mm. dd'n); printf("please input the date again: 二 rt); scanf ("%s,ad. date);printf("please input the address of reader: n);scanf (s,ad. readeraddr);fprintf(fp,/z%15s %8s %13s %7d %7. 2f %10. 2f %13s %-50sn,ad. name, ad. se
26、x, ad. dialnumber, ad. count, ad. price, ad. count*ad price ,ad. date, ad. readeraddr);fclose(fp);return 1;int updatemsg(char *currdate)msgnode currnode,movenode ;int i二0, j二0;file *fp;if (fp=fopen (,zmsg. txt/z, :rt+)二二null) printf (sn/z, zzcarmot open the file or cannot find thefile.please check o
27、ut );return 0;i二ftell (fp);fscanf(fp, s%s%s%d%f%f%s%s,currnode. name, currnode- sex, currnode- dialnumber,&currnode, count,&currnode, price, &currnode, moncy, currnode. date, cu rrnode. readeraddr);j=ftell(fp); j二jl;rewind (fp); while(!fcof (fp) fscanf(fp, s%s%s%d%f%f%s%s,currnode. name,
28、 currnode. sex, currnode. dialnumber,&currnode. count, &currnode. price, &currnode. money, currnode. date, currnode.readeraddr);if(feof(fp)break;if (stremp(currdate, currnode. date)0) fseek(fp, -j, 1);fprintf(fp, 15s %8s %13s %7d %7. 2f %10. 2f %13s %-50s ,null, "null", null, 0
29、,0. 0, 0. 0, 9999. 99. 99,null); fseek (fp, 2l, 1);return 1;int outputall() file *fp;msgnode oa;int allcount二0;float allmoney=0;if (fp=fopcn (,zmsg. txt,“rt)=null) printf ("cannot open the file or cannot find the file, please check out n);getch();:return 0;printf (zz%15s %8s %13s %7s %7s %10s %
30、13s %-50sn",readername , readsex , number,count , price , moneysum , date , readeraddress ;; while(!feof(fp) fscanf(fp, s%s%s%d%f%f%s%s,oa. name, oa. sex, oa. dialnumber, &oa. count,&oa. price, &oa. money, oa. date, oa. readeraddr);if(feof(fp)break;allcount+=oa. count;allmoney+=oa.
31、money;if (strcnip(oa. sex, "null”)printfc%15s %8s %13s %7d %7. 2f %10. 2f %13s %-50sn,oa. name, oa. sex, oa. dialnumber, oa. count, oa. price, oa. money, oa. date,oa. readeraddr);printfc%15s %8s %13s %7d %7. 2f %10. 2f %13s %-50sn/z, all count, /z, all money, 2007. 09. 04,int checkreader(char *
32、name)file *fp; int i, j;char ch;msgnode cr;if (fp=fopen (,zmsg. txt/z, :rt)二二null) printf (cannot open the file or cannot find the file, please check out “);getch();return 0;i二ftell(fp);fscanf(fp, s%s%s%d%f%f%s%s,cr. name, cr. sex, cr. dialnumber, &cr. count, &cr. price, &cr. money, cr.
33、da te,cr.readeraddr);j=ftell(fp);rewind(fp); j=j-1;while(!feof(fp) fscanf (fp, s%s%s%d%f%f%s%s,cr. name, cr. sex, cr. dialnumber, &cr. count, &cr. price, &cr. money, cr. da te,cr.readeraddr);i=ftell(fp);if(!stremp(cr. name, name)printf (z/the reader you are checking is existed in the lis
34、t. n);fseek(fp, -j, 1);fscanf(fp, s%s%s%d%f%f%s%s,cr. name, cr. sex, cr. dialnumber, &cr. count,&cr. price, &cr. money, cr. date, cr. readeraddr);if(feof(fp)break;printf (15s %8s %13s %7d %7f %10f %13s %-50sn ,cr. name, cr. sex, cr. dialnumber, cr. cou nt,cr. price, cr. money, cr. date,
35、cr. r eaderaddr);return 1;int displayreader(char *date)file *fp;int i, j;msgnode er;辻(fp=fopen(zzmsg. txt",)二二null) printf (,zcannot open the file or cannot find the file, please check out .);getch();rctutn 0;wh订e(!feof (fp) fscanf(fp, s%s%s%d%f%f%s%s,cr. name, cr. sex, cr. dialnumber, &cr.
36、 count, &cr. price, &cr. moncy, cr. da te, cr. readeraddr);if(feof(fp)break;辻(! stremp (9999. 99. 99,cr. date)continue;if (stremp(date, cr. date)0 ) printf(,z%15s %8s %13s %7d%7f %10f %13s %-50sn,cr. name, cr. sex, cr. dialnumber, cr. cou nt,cr. price, cr. money, cr. date, cr. r eaderaddr);return 1;main() char str 30;int ch;start ();textout ();scanf(d,&ch);wh订e(ch!=5) if (ch=0)p
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026重庆秀山土家族苗族自治县公益岗招聘2人备考题库完美版
- 北京市海淀区中关村第三小学教育集团幼儿园招聘参考题库含答案
- 2026青海西宁湟源县申中乡卫生院乡村医生招聘6人参考题库及答案1套
- 2026重庆飞驶特人力资源管理有限公司招聘派往某机关事业单位招聘1人参考题库新版
- 2026黑龙江哈尔滨启航劳务派遣有限公司派遣到哈工大仪器学院导航仪器研究所招聘参考题库新版
- 赣州市保育院招聘残疾人备考题库必考题
- 2026重庆银行社会招聘50人备考题库及答案1套
- 丰城市行政事业单位编外人员招聘【5人】备考题库及答案1套
- 西宁市第一人民医院工作人员招聘信息参考题库及答案1套
- 2026陕西西安交通大学能动学院管理辅助工作人员招聘1人参考题库附答案
- 2026年数据管理局考试题库及实战解答
- 2024年集美大学马克思主义基本原理概论期末考试笔试真题汇编
- 2026国家电投秋招面试题及答案
- 数字化背景下幼儿园教育评价反馈策略与实施路径研究教学研究课题报告
- 全身麻醉后恶心呕吐的预防与护理
- 艾滋病初筛实验室标准
- 11334《纳税筹划》国家开放大学期末考试题库
- 2025版临床用血技术规范解读课件
- 毒性中药饮片培训
- 2025-2026学年人教版三年级道德与法治上册期末测试卷题(附答案)
- 城市广场石材铺装施工方案详解
评论
0/150
提交评论