ImageVerifierCode 换一换
格式:DOC , 页数:38 ,大小:309.54KB ,
资源ID:2535085      下载积分:12 金币
验证码下载
登录下载
邮箱/手机:
图形码:
验证码: 获取验证码
温馨提示:
支付成功后,系统会自动生成账号(用户名为邮箱或者手机号,密码是验证码),方便下次登录下载和查询订单;
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

开通VIP
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.zixin.com.cn/docdown/2535085.html】到电脑端继续下载(重复下载【60天内】不扣币)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

开通VIP折扣优惠下载文档

            查看会员权益                  [ 下载后找不到文档?]

填表反馈(24小时):  下载求助     关注领币    退款申请

开具发票请登录PC端进行申请


权利声明

1、咨信平台为文档C2C交易模式,即用户上传的文档直接被用户下载,收益归上传人(含作者)所有;本站仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。所展示的作品文档包括内容和图片全部来源于网络用户和作者上传投稿,我们不确定上传用户享有完全著作权,根据《信息网络传播权保护条例》,如果侵犯了您的版权、权益或隐私,请联系我们,核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
2、文档的总页数、文档格式和文档大小以系统显示为准(内容中显示的页数不一定正确),网站客服只以系统显示的页数、文件格式、文档大小作为仲裁依据,个别因单元格分列造成显示页码不一将协商解决,平台无法对文档的真实性、完整性、权威性、准确性、专业性及其观点立场做任何保证或承诺,下载前须认真查看,确认无误后再购买,务必慎重购买;若有违法违纪将进行移交司法处理,若涉侵权平台将进行基本处罚并下架。
3、本站所有内容均由用户上传,付费前请自行鉴别,如您付费,意味着您已接受本站规则且自行承担风险,本站不进行额外附加服务,虚拟产品一经售出概不退款(未进行购买下载可退充值款),文档一经付费(服务费)、不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
4、如你看到网页展示的文档有www.zixin.com.cn水印,是因预览和防盗链等技术需要对页面进行转换压缩成图而已,我们并不对上传的文档进行任何编辑或修改,文档下载后都不会有水印标识(原文档上传前个别存留的除外),下载后原文更清晰;试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓;PPT和DOC文档可被视为“模板”,允许上传人保留章节、目录结构的情况下删减部份的内容;PDF文档不管是原文档转换或图片扫描而得,本站不作要求视为允许,下载前可先查看【教您几个在下载文档中可以更好的避免被坑】。
5、本文档所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用;网站提供的党政主题相关内容(国旗、国徽、党徽--等)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
6、文档遇到问题,请及时联系平台进行协调解决,联系【微信客服】、【QQ客服】,若有其他问题请点击或扫码反馈【服务填表】;文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“【版权申诉】”,意见反馈和侵权处理邮箱:1219186828@qq.com;也可以拔打客服电话:4009-655-100;投诉/维权电话:18658249818。

注意事项

本文(操作系统专业课程设计范文样本.doc)为本站上传会员【天****】主动上传,咨信网仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知咨信网(发送邮件至1219186828@qq.com、拔打电话4009-655-100或【 微信客服】、【 QQ客服】),核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载【60天内】不扣币。 服务填表

操作系统专业课程设计范文样本.doc

1、 课程设计 学生学院 计算机学院 专业班级 12(1)班 学 号 311351 学生姓名 吴炜文 指引教师 李敏 1 月 10 日 目录 1 简朴文献系统…………………………………………………………

2、 文献系统 一、实验目: 模仿文献管理功能,理解各种文献操作。 二、实验内容: 1、设计一种10个顾客文献系统,每次顾客可保存10个文献,一次运营顾客可以打开5个文献 2、程序采用二级文献目录(即设立主目录[MFD])和顾客文献目录(UED)。此外,为打开文献设立了运营文献目录(AFD)。 3、为了便于实现,对文献读写作了简化,在执行读写命令时,只需改读写指针,并不进行实际读写操作。 4、算法与框图: a、因系统小,文献目录检索使用了简朴线性搜索。 b、文献保护简朴

3、使用了三位保护码:容许读写执行、相应位为 1,相应位为0,则表达不容许读写、执行。 c、程序中使用重要设计构造如下: i  主文献目录和顾客文献目录( MFD、UFD) ii 打开文献目录( AFD)(即运营文献目录) 规定:用高档语言编写和调试一种简朴文献系统,模仿文献管理工作过程。从而对各种文献操作命令实质内容和执行过程有比较进一步理解。 规定设计一种 n个顾客文献系统,每次顾客可保存m个文献,顾客在一次运营中只能打开一种文献,对文献必要设立保护办法,且至少有Create、delete、open、close、read、write等命令。   文献系统算法流程图如下:

4、 三、源代码及运营成果: #include "stdio.h" #include "string.h" #include "conio.h" #include "stdlib.h" #define MAXNAME 25 /*the largest length of mfdname,ufdname,filename*/ #define MAXCHILD 50 /*the largest child*/ #define MAX (MAXCHILD*MAXCHILD) /*the size of fpaddrno*/ typedef struct /*the structure

5、 of OSFILE*/ {int fpaddr; /*file physical address*/ int flength; /*file length*/ int fmode; /*file mode:0-Read Only;1-Write Only;2-Read and Write(default);*/ char fname[MAXNAME]; /*file name*/ } OSFILE; typedef struct /*the structure of OSU

6、FD*/ {char ufdname[MAXNAME]; /*ufd name*/ OSFILE ufdfile[MAXCHILD]; /*ufd own file*/ }OSUFD; typedef struct /*the structure of OSUFD'LOGIN*/ {char ufdname[MAXNAME]; /*ufd name*/ char ufdpword[8]; /*ufd password*/ } OSUFD_LOGIN; typedef struct /*file open m

7、ode*/ {int ifopen; /*ifopen:0-close,1-open*/ int openmode; /*0-read only,1-write only,2-read and write,3-initial*/ }OSUFD_OPENMODE; OSUFD *ufd[MAXCHILD]; /*ufd and ufd own files*/ OSUFD_LOGIN ufd_lp; int ucount=0; /*the count of mfd's ufds*/ int fcount[MAXCHILD]; /*the count of uf

8、d's files*/ int loginsuc=0;/*whether login successfully*/ char username[MAXNAME]; /*record login user's name22*/ char dirname[MAXNAME];/*record current directory*/ int fpaddrno[MAX]; /*record file physical address num*/ OSUFD_OPENMODE ifopen[MAXCHILD][MAXCHILD];/*record file open/close*/ int w

9、getchar;/*whether getchar()*/ FILE *fp_mfd,*fp_ufd,*fp_file_p,*fp_file; void main() {int i,j,choice1; char choice[50]; /*choice operation:dir,create,delete,open,delete,modify,read,write*/ int choiceend=1; /*whether choice end*/ char *rtrim(char *str); /*remove the trailing blanks.*/ char

10、ltrim(char *str); /*remove the heading blanks.*/ void LoginF(); /*LOGIN FileSystem*/ void DirF(); /*Dir FileSystem*/ void CdF(); /*Change Dir*/ void CreateF(); /*Create File*/ void DeleteF();/*Delete File*/ void ModifyFM();/*Modify FileMode*/ void OpenF(); /*Open File*/ void CloseF(

11、); /*Close File*/ void ReadF();/*Read File*/ void WriteF();/*Write File*/ void QuitF();/*Quit FileSystem*/ void help(); if((fp_mfd=fopen("c:\\osfile\\mfd","rb"))==NULL) {fp_mfd=fopen("c:\\osfile\\mfd","wb"); fclose(fp_mfd); } for(i=0;i

12、K*16|WHITE); clrscr(); /*clear screen*/ LoginF(); /*user login*/ clrscr(); if(loginsuc==1) /*Login Successfully*/ {while (1) {wgetchar=0; if (choiceend==1) {printf("\n\nC:\\%s>",strupr(dirname));} else printf("Bad command or file name.\nC:\\%s>",strupr(username)); gets(ch

13、oice); strcpy(choice,ltrim(rtrim(strlwr(choice)))); if (strcmp(choice,"dir")==0) choice1=1; else if(strcmp(choice,"creat")==0) choice1=2; else if(strcmp(choice,"delete")==0) choice1=3; else if(strcmp(choice,"attrib")==0) choice1=4; else if(strcmp(choice,"open")==0) choice1=5;

14、 else if(strcmp(choice,"close")==0) choice1=6; else if(strcmp(choice,"read")==0) choice1=7; else if(strcmp(choice,"modify")==0) choice1=8; else if(strcmp(choice,"exit")==0) choice1=9; else if(strcmp(choice,"cls")==0) choice1=10; else if(strcmp(choice,"cd")==0) choice1=11;

15、 else if(strcmp(choice,"help")==0) choice1=20; else choice1=12; switch(choice1) {case 1:DirF();choiceend=1;break; case 2:CreateF();choiceend=1;if(!wgetchar) getchar();break; case 3:DeleteF();choiceend=1;if(!wgetchar)getchar();break; case 4:ModifyFM();choiceend=1;if(!

16、wgetchar) getchar();break; case 5:choiceend=1;OpenF();if (!wgetchar) getchar();break; case 6:choiceend=1;CloseF();if (!wgetchar) getchar();break; case 7:choiceend=1;ReadF();if (!wgetchar) getchar();break; case 8:choiceend=1;WriteF();if (!wgetchar) getchar();break; case 9:pri

17、ntf("\nYou have exited this system."); QuitF();exit(0);break; case 10:choiceend=1;clrscr();break; case 11:CdF();choiceend=1;break; case 20:help();choiceend=1;break; default:choiceend=0; } } } else printf("\nAccess denied."); } void help(void) { pr

18、intf("\nThe Command List\n"); printf("\nCd Attrib Creat Modify Read Open Cls Delete Exit Close\n"); } char *rtrim(char *str) /*remove the trailing blanks.*/ {int n=strlen(str)-1; while(n>=0) {if(*(str+n)!=' ') {*(str+n+1)='\0'; break; } else n--; } if (n<0) str

19、[0]='\0'; return str; } char *ltrim(char *str) /*remove the heading blanks.*/ {char *rtrim(char *str); strrev(str); rtrim(str); strrev(str); return str; } void LoginF() /*LOGIN FileSystem*/ {char loginame[MAXNAME],loginpw[9],logincpw[9],str[50]; int i,j,flag=1; char a[25]; int

20、 findout;/*login user not exist*/ char *rtrim(char *str); /*remove the trailing blanks.*/ char *ltrim(char *str); /*remove the heading blanks.*/ void InputPW(char *password); /*input password,use '*' replace*/ void SetPANo(int RorW); /*Set physical address num*/ while(1) {findout=0; pr

21、intf("\n\nLogin Name:"); gets(loginame); ltrim(rtrim(loginame)); fp_mfd=fopen("c:\\osfile\\","rb"); for(i=0;fread(&ufd_lp,sizeof(OSUFD_LOGIN),1,fp_mfd)!=0;i++) if (strcmp(strupr(ufd_lp.ufdname),strupr(loginame))==0) {findout=1; strcpy(logincpw,ufd_lp.ufdpword); } fclose(

22、fp_mfd); if (findout==1) /*user exist*/ {printf("Login Password:"); InputPW(loginpw);/*input password,use '*' replace*/ if (strcmp(loginpw,logincpw)==0) {strcpy(username,strupr(loginame)); strcpy(dirname,username); fp_mfd=fopen("c:\\osfile\\","rb"); fo

23、r(j=0;fread(&ufd_lp,sizeof(OSUFD_LOGIN),1,fp_mfd)!=0;j++) {strcpy(str,"c:\\osfile\\"); strcat(str,ufd_lp.ufdname); ufd[j]=(OSUFD*)malloc(sizeof(OSUFD)); strcpy(ufd[j]->ufdname,strupr(ufd_lp.ufdname)); fp_ufd=fopen(str,"rb"); fcount[j]=0;

24、 for(i=0;fread(&ufd[j]->ufdfile[i],sizeof(OSFILE),1,fp_ufd)!=0;i++,fcount[j]++) {ifopen[j][i].ifopen=0; ifopen[j][i].openmode=4;} fclose(fp_ufd);} fclose(fp_mfd); ucount=j; SetPANo(0); printf("\n\nLogin successful!Welcome to this

25、FileSystem\n\n"); loginsuc=1; return;} else {printf("\n\n"); flag=1; while(flag) {printf("Login Failed! Password Error. Try Again(Y/N):"); gets(a); ltrim(rtrim(a)); if (strcmp(strupr(a),"Y")==0) {loginsuc=0;flag=0;} else if(s

26、trcmp(strupr(a),"N")==0){loginsuc=0;flag=0;return;} } } } else {printf("New Password(<=8):"); InputPW(loginpw);/*input new password,use '*' replace*/ printf("\nConfirm Password(<=8):");/*input new password,use '*' replace*/ InputPW(logincpw);

27、 if (strcmp(loginpw,logincpw)==0) {strcpy(ufd_lp.ufdname,strupr(loginame)); strcpy(ufd_lp.ufdpword,loginpw); fp_mfd=fopen("c:\\osfile\\","ab"); fwrite(&ufd_lp,sizeof(OSUFD_LOGIN),1,fp_mfd); fclose(fp_mfd); strcpy(username,strupr(loginame)); strcpy(dirn

28、ame,loginame); strcpy(str,"c:\\osfile\\"); strcat(str,username); if((fp_ufd=fopen(str,"rb"))==NULL) {fp_ufd=fopen(str,"wb"); fclose(fp_ufd); } fp_mfd=fopen("c:\\osfile\\","rb"); for(j=0;fread(&ufd_lp,sizeof(OSUFD_LOGIN),1,fp_mfd)!=0;j++)

29、 {strcpy(str,"c:\\osfile\\"); strcat(str,ufd_lp.ufdname); ufd[j]=(OSUFD*)malloc(sizeof(OSUFD)); strcpy(ufd[j]->ufdname,strupr(ufd_lp.ufdname)); fp_ufd=fopen(str,"rb"); for(i=0;fread(&ufd[j]->ufdfile[i],sizeof(OSFILE),1,fp_ufd)!=0;i++,fcount[

30、j]++) {ifopen[j][i].ifopen=0; ifopen[j][i].openmode=4;} fclose(fp_ufd);} fclose(fp_mfd); ucount=j; SetPANo(0); printf("\n\nLogin Successful!Welcome to this System\n\n"); loginsuc=1; return; } else {print

31、f("\n\n"); flag=1; while(flag) {printf("Login Failed!Password Error. Try Again(Y/N):"); gets(a); ltrim(rtrim(a)); if (strcmp(strupr(a),"Y")==0) {loginsuc=0;flag=0;} else if(strcmp(strupr(a),"N")==0){loginsuc=0;flag=0;return;} } } } } } void Se

32、tPANo(int RorW) /*Set physical address num,0-read,1-write*/ {int i,j; if (RorW==0) {if((fp_file_p=fopen("c:\\osfile\\file\\file_p","rb"))==NULL) {fp_file_p=fopen("c:\\osfile\\file\\file_p","wb"); fclose(fp_file_p); } fp_file_p=fopen("c:\\osfile\\file\\file_

33、p","rb"); for(i=0;fread(&j,sizeof(int),1,fp_file_p)!=0;i++) fpaddrno[j]=1; /*for(i=1;i

34、r(i=0;i

35、rd[j])!=8) putchar('*'); else {if (j>0) {j--;j--; putchar('\b');putchar(' ');putchar('\b'); } else j--; } } else {password[j]='\0'; break; } } password[j]='\0'; } void DirF()

36、 /*Dir FileSystem*/ {int i,j,count=0; char sfmode[25],sfpaddr[25],str[25]; int ExistD(char *dirname); /*Whether DirName Exist,Exist-i,Not Exist-0*/ clrscr(); if (strcmp(strupr(ltrim(rtrim(dirname))),"")!=0) {printf("\n\nC:\\%s>dir\n",dirname); printf("\n%14s%16s%14s%10s%18s\n","FileName",

37、"FileAddress","FileLength","Type","FileMode"); j=ExistD(dirname); for(i=0;i

38、 } itoa(ufd[j]->ufdfile[i].fpaddr,str,10); strcpy(sfpaddr,"file"); strcat(sfpaddr,str); if (ufd[j]->ufdfile[i].fmode==0) strcpy(sfmode,"Read Only"); else if(ufd[j]->ufdfile[i].fmode==1) strcpy(sfmode,"Write Only"); else if(ufd[j]->ufdfile[i].fmode==2)strcpy(sfmode,"R

39、ead And Write"); else strcpy(sfmode,"Protect"); printf("%14s%16s%14d%10s%18s\n",ufd[j]->ufdfile[i].fname,sfpaddr,ufd[j]->ufdfile[i].flength,"",sfmode); } printf("\n %3d file(s)\n",fcount[j]);} else {printf("\n\nC:\\>dir\n"); printf("\n%14s%18s%8s\n","DirName","OwnFileCount",

40、"Type"); for(i=0;iufdname,fcount[i],""); count=count+fco

41、unt[i]; } printf("\n %3d dir(s),%5d file(s)\n",ucount,count); } } int ExistD(char *dirname) /*Whether DirName Exist,Exist-i,Not Exist-0*/ {int i; int exist=0; for(i=0;iufdname),strupr(dirname))==0) {exist=1; break; }

42、 if (exist) return(i); else return(-1); } void CdF() /*Exchange Dir*/ {char dname[MAXNAME]; char *rtrim(char *str); /*remove the trailing blanks.*/ char *ltrim(char *str); /*remove the heading blanks.*/ int ExistD(char *filename); /*Whether FileName Exist,Exist-i,Not Exist-0*/ printf("\

43、nPlease input DirName (cd..-Previous dir;DirNAME-cd [DirNAME]):"); gets(dname); ltrim(rtrim(dname)); if (ExistD(dname)>=0) strcpy(dirname,strupr(dname)); else if(strcmp(strupr(dname),"CD..")==0) strcpy(ltrim(rtrim(dirname)),""); else printf("\nError.\'%s\' does not exist.\n",dname); }

44、void CreateF() /*Create File*/ {int fpaddrno,flag=1,i; char fname[MAXNAME],str[50],str1[50],strtext[255],a[25]; char fmode[25]; char *rtrim(char *str); /*remove the trailing blanks.*/ char *ltrim(char *str); /*remove the heading blanks.*/ int FindPANo(); /*find out physical address num*/

45、 int WriteF1();/*write file*/ int ExistF(char *filename); /*Whether FileName Exist,Exist-i,Not Exist-0*/ int ExistD(char *dirname); if (strcmp(strupr(dirname),strupr(username))!=0) {printf("\nError. You must create file in your own dir.\n");wgetchar=1;} else { printf("\nPlease input Fi

46、leName:"); gets(fname); ltrim(rtrim(fname)); if (ExistF(fname)>=0) {printf("\nError. Name \'%s\' has already existed.\n",fname); wgetchar=1; } else {printf("Please input FileMode(0-Read Only,1-Write Only,2-Read and Write,3-Protect):"); gets(fmode); ltrim(rtrim(fmod

47、e)); if((strcmp(fmode,"0")==0)||(strcmp(fmode,"1")==0)||(strcmp(fmode,"2")==0)||(strcmp(fmode,"3")==0)) {fpaddrno=FindPANo(); if (fpaddrno>=0) {i=ExistD(username); strcpy(ufd[i]->ufdfile[fcount[i]].fname,fname); ufd[i]->ufdfile[fcount[i]].fpaddr=fpaddrno;

48、ufd[i]->ufdfile[fcount[i]].fmode=atoi(fmode); ifopen[i][fcount[i]].ifopen=0; ifopen[i][fcount[i]].openmode=4; strcpy(str,"c:\\osfile\\file\\file"); itoa(fpaddrno,str1,10); strcat(str,str1); fp_file=fopen(str,"wb"); fclose(fp_file); fcount[i]++;

49、 while(flag) {printf("Input text now(Y/N):"); gets(a); ltrim(rtrim(a)); ufd[i]->ufdfile[fcount[i]-1].flength=0; if(strcmp(strupr(a),"Y")==0) {fp_file=fopen(str,"wb+"); ufd[i]->ufdfile[fcount[i]-1].flength=WriteF1(); flag=0;

50、 } else if(strcmp(strupr(a),"N")==0){flag=0;wgetchar=1;} } printf("\n\'%s\' has been created successfully!\n",fname); } else {printf("\nFail!No Disk Space. Please format your disk.\n");wgetchar=1;} } else {printf("\nError. FileMode\'s Rang

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2025 宁波自信网络信息技术有限公司  版权所有

客服电话:4009-655-100  投诉/维权电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服