分析归纳在加以判断修改.当然修改程序的时间花的较长也较为枯燥需要忍耐在此谢谢伙伴的支持与陪伴. 谢谢伙伴的支持与陪伴. 希望以后还有这样的机会和时间 和同伴一起编写程序 以此对这类题目加深对这类题目熟悉与熟练 希望以后还有这样的机会和时间 和同伴一起编写程序 以此对这类题目加深对这类题目熟悉与熟练 语言代码. 能在以后能快速而熟练的编写此类的 C 语言代码. 六附录程 序 源 代 码 includeltstdio.hgt includeltstdio.hgtincludeltstring.hgt includeltstdlib.hgt structhotel_list int number intprice room10 2000370200475 200580200685200790200895 20091002010105 struct struct time int year int month int day struct kehu_information char name20 charID20 struct time begin struct time end int numint daytime int price int expense structkehu_information next /定义一个结构体保存客户的信息/ /定义一个结构体保存客户的信息/ 定义一个结构体保存客户的信息 //定义日期结构 //定义日期结构 //定义房间结构并赋除值 //定义房间结构并赋除值 int menu_show 单显示/ 单显示/ struct/创建链表输入客户信息/ /创建链表输入客户信息 / 创 建 链 表 void checkint numberstructkehu_information kehu_informationkehu_information /菜 /菜 creat head /查询房间入住情况/ /查询房间入住情况/ 查询房间入 住 情 况 void allpriceint numberstruct timebeginstruct time endstruct kehu_informationhead endstruct 统计客户所付的总费用/ 统计客户所付的总费用/ int tiannumstruct time begin询某月份的具体天数/ 询某月份的具体天数/ intyanzhengstruct kehu_information pstructkehu_information head /求 /求 /验证该房间是否 有 人 住 / / 验 证 该 房 间 是 否 有 人 住 / intyuestruct time p 某月份的天数/ 某月份的天数/xianshi/显示房间号和价格 void xianshi/显示房间号和价格 / int i printfquot 房间信息quotprintfquotn 房 间 信 息 quot printfquot printfquotnfori0ilt10i printfquot //主函 数 //主 函数main /定义链表的头节点 定义链表的头节点/struct kehu_information headNULL /定义链表的头 节 点 / int inumchioce char c1c2c3c4struct time p1p2 systemquotclsquot systemquotclsquot/ 清 屏 / / 清 屏 / 清屏 4d 6d 6dnquotroomi.numberroomi.price房间号 房间价格 房间价格nquot /查 /查 / /无限 循 环 无 限 循 环 / while1 / 无 限 循 环 /chiocemenu_show switchchioce case 1:systemquotclsquot xianshi break case 2:systemquotclsquot headcreat break case 3:systemquotclsquot systemquotclsquot printfquot 查询房间信息quot printfquotn 查询房间信息quot printfquot 请输入要查询的房间号: printfquotn 请输入要查询的房间号 : quot scanfquotdquotampnumfori0ilt10i ifnumroomi.numberbreak ifi10 printfquot 输 入 房 间 号 有 误 printfquot 输 入 房 间 号 有 误 nquot 输 入 房 间 号 有 误break checknumhead break case 4:systemquotclsquot printfquot 统 计 房 间 费 用 quotprintfquotn 统计房间费用quot printfquot请输入要查询的房间号: printfquot请输入要查询的房间号: quot 请输入要查询的房间号 scanfquotdquotampnum printfquot请输入要查询的房间的开始时间: printfquot请输入要查询的房间的开始时间: quot 请输入要查询的房间的开始时间scanfquotdcdcdquotampp1.yearampc1ampp1.monthampc2ampp1.dayscanfquotdcdcdquotampp1.yearampc1ampp1.monthampc2ampp1.day printfquot请 输入 要查 询的 房间 的结束 时间 :printfquot请输入要查询的房间的结束时间: quot 请输入要 查 询 的 房 间 的 结 束 时 间scanfquotdcdcdquotampp2.yearampc3ampp2.monthampc4ampp2.day allpricenump1p2head break case 0:exit0 return 0 /菜单函数函数返回值为整数代表所选的菜单项/ /菜单函数函数返回值为整数代表所选的菜单项/ 菜单函数 menu_show intmenu_show int c char s10 printfquot 请按任意键继续...... nquot/提示压任意键继续 ...... 提示 压 任 意 键 继 续 / printfquotn 请 按 任 意 键 继续......nquot/提示压任意键继续/ /读入任意字符读 入 任 意 字 符 / getchar / 读 入 任 意 字 符 /getchar systemquotclsquot /清屏/ /清屏/ 清屏printfquotn酒店房间登记与计费管 理 菜 单 printfquotn酒店房间登记与计费管理菜单nquot 酒店房间登记与计 费 管 理 菜 单 printfquotn1: 显 示 房 间 号 及 价格 :printfquotn1: 显 示 房 间 号 及 价格 :nquot 显示 房间号及 价 格 :printfquotn2: 请 输 入 客 户 信 息printfquotn2: 请 输 入 客 户 信 息nquot 请输 入 客户信 息 printfquotn3: 查 询 房 间 入 住 情 况printfquotn3: 查 询 房 间 入 住 情 况nquot 查询房 间入住情 况 printfquotn4:计算客户需要支付的总 费 用 nquotprintfquotn4:计算客户需要支付的总费用nquot 计算客户需要支付 的 总 费 用 printfquotprintfquotn0: 退 出nquotprintfquotnprintfquotnnquot printfquotprintfquotn scanfquotsquots catois/把字符串转化为整型/ catois/把字符串转化为整型/ 把字符串转化为整型 /返回选择项 主程序根据该数调用相应的函数/ 返回选择项 return c /返回选择项主程序根据该数调用相应的函数/ 之间的数选择需要的操作:quot /提示输入选项 提示输入选项/ 请输入0-4 之间的数选择需要的操作:quot /提示输入选项/int lenint n int i1 ifngt0ampampnlt10 i2else // 求 数 的 长 度 // 求 数 的 长 度whilengt9 nn/10 i return i begin/计算天数 计算天数/ int tianstruct time begin/计 算 天 数 / int kleap1day1 inttab213 03128330313031 03128330330313031 leap1begin.year40ampampbegin.year1000begin.year4000 day1begin.dayfork1kltbegin.monthkday1day1tableap1k return day1 intyuestruct time p int ileapn inttab213 03128330313031 03129330313031 leapp.year40ampampp.year1000p.year4000 ifleap1 fori1ilt13iifp.monthi ifp.monthi ntab1i else fori1ilt13i ifp.monthintab0i return n struct kehu_informationcreat struct kehu_information headptailstruct time m1m2 int innumname20s20e1f1e2f2 charname20s20e1f1e2f2 headNULLprintfquotn 输 入 客 户 信 息 printfquotn 输 入客 户 信 息 nquot 输 入 客 户 信 息 printfquot 请 输 入 客 户 的 姓 名 :printfquotn 请输入客户的姓名: quot scanfquotsquotnamewhilename0 pstruct kehu_information mallocsizeofstruct kehu_informationstrcpypstrcpyp-gtnamename printfquotn 请 输 入客户的身份证号: quot rintfquot 请输入客户的身份证号:scanfquotsquots nstrlenswhilen15ampampn18 printfquot 身份 证 号输 入 有误 请重新输入: printfquot身份证号输入有误n 请重新输入 : quot 身 份 证 号 输 入 有 误 scanfquotsquotsnstrlens strcpypstrcpyp-gtIDs printfquot请输入客户的开始入住时间: printfquot请输入客户的开始 入 住 时 间 : quot 请 输 入 客 户 的 开 始
上一篇:
【精品】第一次安装TUXEDO FOR LINUX 全过程
下一篇:
让我掉下眼泪的