实验三linux_c_程序设计

实验三linux_c_程序设计

ID:11461898

大小:170.50 KB

页数:19页

时间:2018-07-12

实验三linux_c_程序设计_第1页
实验三linux_c_程序设计_第2页
实验三linux_c_程序设计_第3页
实验三linux_c_程序设计_第4页
实验三linux_c_程序设计_第5页
资源描述:

《实验三linux_c_程序设计》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、《Linux程序开发环境》实验报告实验成绩:批阅教师:年月日实验3LinuxC程序设计1、实验目的(1)掌握Linuxshell程序运行方法(2)掌握LinuxShell程序基本语法(3)了解Linux环境变量(4)编写简单Linuxshell程序2、实验内容使用curses库完成CD唱片管理系统的C语言简单用户界面版。实验步骤见附录。3、实验记录(1)实验报告中提交系统的完整脚本;#include#include#include#include#include<

2、curses.h>#defineMAX_STRING(80)/*Longestallowedresponse*/#defineMAX_ENTRY(1024)/*Longestalloweddatabaseentry*/#defineMESSAGE_LINE6/*Misc.messagesgohere*/#defineERROR_LINE22/*Thelinetouseforerrors*/#defineQ_LINE20/*LineforQuestions*/#definePROMPT_LINE18/*Lineforpromptingon*/

3、staticcharcurrent_cd[MAX_STRING]="";staticcharcurrent_cat[MAX_STRING];constchar*title_file="title.cdb";constchar*tracks_file="tracks.cdb";constchar*temp_file="cdb.tmp";/*Prototypesforlocalfunctions*/voidclear_all_screen(void);voidget_return(void);intget_confirm(void);int

4、getchoice(char*greet,char*choices[]);voiddraw_menu(char*options[],inthighlight,intstart_row,intstart_col);voidinsert_title(char*cdtitle);voidget_string(char*string);voidadd_record(void);voidcount_cds(void);voidfind_cd(void);voidlist_tracks(void);voidremove_tracks(void);voi

5、dremove_cd(void);voidupdate_cd(void);/*菜单项*/char*main_menu[]={"aaddnewCD","ffindCD","ccountCDsandtracksinthecatalog","qquit",0,};/*TheextendedmenuisdisplayedwhenaCDiscurrentlyselected*/char*extended_menu[]={"aaddnewCD","ffindCD","ccountCDsandtracksinthecatalog","llisttrack

6、soncurrentCD","rremovecurrentCD","uupdatetrackinformation","qquit",0,};intmain(){intchoice;initscr();do{choice=getchoice("Options:",current_cd[0]?extended_menu:main_menu);switch(choice){case'q':break;case'a':add_record();break;case'c':count_cds();break;case'f':find_cd();br

7、eak;case'l':list_tracks();break;case'r':remove_cd();break;case'u':update_cd();break;}}while(choice!='q');endwin();exit(EXIT_SUCCESS);}/*main*///addmenu/*getchoice-asktheusertochoosepassed:greet,anintroductionchoices,anarrayofstrings,NULLatend*/intgetchoice(char*greet,char*

8、choices[]){staticintselected_row=0;intmax_row=0;intstart_screenrow=MESSAGE_LINE,start_scr

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。