当前位置: 代码迷 >> C语言 >> 大家那里有没有图书员管理系统(任何语言编辑都可)
  详细解决方案

大家那里有没有图书员管理系统(任何语言编辑都可)

热度:370   发布时间:2005-02-05 22:29:00.0
大家那里有没有图书员管理系统(任何语言编辑都可)
大家那里有没有图书员管理系统(任何语言编辑都可)
搜索更多相关的解决方案: 图书员  语言编辑  系统  管理  

----------------解决方案--------------------------------------------------------
帮个忙,完成作业!
----------------解决方案--------------------------------------------------------
放心,神会帮你完成的,这点我有信心
----------------解决方案--------------------------------------------------------
你的意思是说神-乐于助人,还是说他见女生就疯狂到忘我那?????
----------------解决方案--------------------------------------------------------
怎么现在的作业都是什么管理系统系统的。
             好象我们论坛没有帮人作业的传统呵
不过好象这次有些例外哈,作业贴引起广泛关注,
神呢?怎么没见他来?
----------------解决方案--------------------------------------------------------
大家帮个忙吧!哎,我好无奈!大家都指望我,我指望谁!对了,这帖子能不能送积分?怎么送?谁做出来最少送300分!
----------------解决方案--------------------------------------------------------
老规矩,采用命令行提示符界面~~用C语言完成!

给我一天的时间复习C语言,最近玩疯了

[此贴子已经被作者于2005-2-7 9:22:45编辑过]



----------------解决方案--------------------------------------------------------
顺便问问,图书馆管理员系统要求有什么功能啊,是不是要用数据库SQL啊!!怕怕
----------------解决方案--------------------------------------------------------

写好了 恩~~幸好我以前写过的程序还在论坛上保存好~~~稍微改改就可以用了

不过不知道符合要求不,我不知道图书馆管理程序有什么功能啊!! 也不知道界面要求采用什么样的界面。 所以现在用的是最简单的----命令提示符~~~ ^o^

流星雨,你来看看应该修改那里,好要增加和修改那些功能。 改好了我一起把注释写上去。

使用说明:

本程序采用的是双链表的结构,并且头链HEAD和尾链END是指定的,不能更改。 <HEAD>-----<记录1>----<记录2>---- ... ----<记录3>----<END>

很多操作都是围绕now_point(当前节点)来进行的。

new 在当前节点后插入一个新的记录,并且把当前节点指向新记录; del 删除当前节点的记录,当前节点自动指向前一个记录; ver 显示版本号,没什么用,纯粹娱乐; list 显示所有记录; point 显示当前节点所指向的记录; uppoint 当前节点往前移一条记录,不改变当前节点的指向; downpoint当前节点往后移动一条记录,同样不改变当前节点的指向; find 可以按照name或者tel来进行查找,如果找到,当前节点自动指向它; cls 清屏; help帮助命令 quit 退出程序。

[此贴子已经被作者于2005-2-7 11:46:10编辑过]


----------------解决方案--------------------------------------------------------

/******************************************************************************/ /* 作者: 神vlinux飘飘 */ /* bbs.bc-cn.net */ /* 时间:2005年1月13日 */ /* 版权没有,盗版不究 */ /******************************************************************************/

#include <stdio.h> #define BYNAME 0 #define BYID 1

/*数据结构*/ struct note { char name[50]; char id[20]; char price[20]; char publisher[50]; char borrowname[40]; struct note *front_point; struct note *next_point; };

struct note *head_point; /*头节点*/ struct note *end_point; /*尾节点*/ struct note *now_point; /*当前节点,很多操作都是围绕这个节点来完成*/

/*命令函数区*/ void uppoint(); /*当前节点上移一条记录*/ void downpoint(); /*当前节点下移一条记录*/ void save(); /*保存文件*/ void new(); /*在当前节点之后创建一个新的记录,并把当前节点指向新记录*/ void ver(); /*显示版本号,无聊....*/ void del(); /*删除当前节点的记录*/ void list(); /*显示所有的记录*/ void point(); /*显示当前节点所指向的记录*/ void quit(); /*退出程序(推荐选项)*/ void find(); /*查找记录,并且把节点指向找到的记录.有两种查找方式(按书名,按编号)*/ void cls(); /*清屏*/ void help(); /*帮助*/

/*功能函数区*/ void load(); /*装载文件*/ void commandline(); /*命令行,你所有的指令都由它来理解,执行*/ void show(struct note *); /*打印记录*/ void trade(struct note*,struct note*); /*交换两个记录在链表中的位置uppoint和downpoint用*/ struct note *search(char *,int); /*查找记录*/

void main() { ver(); load(); commandline(); }

void help() { printf(" /*_______________________________________________________*/\n"); printf(" | (help)- teach you how to use this program |\n"); printf(" | (new )- creat a new record |\n"); printf(" | (ver )- show the version |\n"); printf(" | (cls )- clear the screen |\n"); printf(" | (point)- show the lock recor |\n"); printf(" | (del )- delete lock record |\n"); printf(" | (find)- find record by bookname or bookid and locked|\n"); printf(" | (list)- show all the record |\n"); printf(" | (save)- save notesave.mmd file |\n"); printf(" | (quit)- quit this program |\n"); printf(" | (uppoint)- the lock record move up |\n"); printf(" |(downpoint)- the lock record move down |\n"); printf(" /*_______________________________________________________*/\n"); printf("\n"); }

void commandline() { char command[256];

printf("Note Master!\nWrite by vlinux\n"); for(;;) { printf("CMD:"); gets(command);

if( strcmp(command,"new")==0 ) new(); else if( strcmp(command,"del")==0 ) del(); else if( strcmp(command,"find")==0 ) find(); else if( strcmp(command,"list")==0 ) list(); else if( strcmp(command,"point")==0 ) point(); else if( strcmp(command,"quit")==0 ) quit(); else if( strcmp(command,"cls")==0 ) cls(); else if( strcmp(command,"ver")==0 ) ver(); else if( strcmp(command,"save")==0 ) save(); else if( strcmp(command,"uppoint")==0 ) uppoint(); else if( strcmp(command,"downpoint")==0)downpoint(); else if( strcmp(command,"help")==0) help(); else printf("Error Bad command!\n\n"); } }

void show(struct note *show_point) { printf("\n_______________________________\n"); printf("BookName : %s\n",show_point->name); printf("BookID : %s\n",show_point->id); printf("Publisher : %s\n",show_point->publisher); printf("PRICE : %s\n",show_point->price); printf("BorrowName: %s",show_point->borrowname); printf("\n_______________________________\n"); }

void list() { struct note *list_point; int count=0;

if( head_point->next_point == end_point ) { printf("This is an empty NOTE!\n"); return; }

list_point=head_point->next_point; for(;list_point->next_point!=NULL;list_point=list_point->next_point) { show(list_point); count++; } printf("Total %d\n\n",count); }

void point() { show(now_point); }

void new() { struct note *new_point; char commands[256];

new_point=(struct note*)malloc(sizeof(struct note));

new_point->next_point=now_point->next_point; new_point->front_point=now_point; now_point->next_point=new_point;

now_point=new_point;

printf("Enter BookName :"); gets(commands); if(strlen(commands)>=50) commands[49]=0; strcpy(new_point->name,commands);

printf("Enter BookID :"); gets(commands); if(strlen(commands)>=20) commands[19]=0; strcpy(new_point->id,commands);

printf("Enter BookPublisher:"); gets(commands); if(strlen(commands)>=50) commands[49]=0; strcpy(new_point->publisher,commands);

printf("Enter BookPrice :"); gets(commands); if(strlen(commands)>=20) commands[19]=0; strcpy(new_point->price,commands);

printf("Enter BorrowerName :"); gets(commands); if(strlen(commands)>40) commands[39]=0; else if(strlen(commands)==0) strcpy(commands,"none"); strcpy(new_point->borrowname,commands);

printf("Creat a new note\n"); show(new_point); printf("\n"); }

void find() { struct note *find_point; char words[256];

printf("FIND....\n"); printf("Enter your search about? BookName(name)/BookID(id):"); gets(words);

if( strcmp(words,"name")== 0 ) { printf("Enter BookName:"); gets(words); find_point=search(words,BYNAME); if( find_point==NULL ) { printf("Sorry,No Found!\n\n"); return; }

else { show(find_point); now_point=find_point; return; } }

if( strcmp(words,"id")== 0 ) { printf("Enter BookID:"); gets(words); find_point=search(words,BYID); if( find_point==NULL ) { printf("Sorry,No Found!\n\n"); return; }

else { show(find_point); now_point=find_point; return; } } printf("Error! please input name/id\n\n"); }

struct note * search(char *words,int type) { struct note *search_point;

search_point=head_point->next_point;

if( type == BYNAME ) { for(;search_point->next_point!=NULL;search_point=search_point->next_point) if( strcmp(search_point->name,words) == 0 ) return search_point; return NULL; }

if( type == BYID ) { for(;search_point->next_point!=NULL;search_point=search_point->next_point) if( strcmp(search_point->id,words) == 0 ) return search_point; return NULL; } }

void quit() { char words[256]; printf("Quit,are you sure?(yes/no)"); gets(words); if( (strcmp(words,"yes"))!=0 ) { printf("Drop action!\n\n"); return; } exit(0); }

void del() { struct note *temp_point; char words[256];

if(head_point->next_point->next_point==NULL) { printf("This is en empty NOTE!\n\n"); return; }

show(now_point); printf("It will delete this record, are you sure?(yes/no) "); gets(words); if( strcmp(words,"yes")!=0 ) { printf("drop this action!\n\n"); return; }

printf("Del the record:\n\n");

temp_point=now_point->front_point;

now_point->next_point->front_point=now_point->front_point; now_point->front_point->next_point=now_point->next_point;

free(now_point);

now_point=temp_point; }

void cls() { int i; for(i=0;i<60;i++) printf("\n"); }

void ver() { printf("\n____________________________________________________________________________"); printf("\n Build by vlinux"); printf("\n @CopyRight"); printf("\n GXDX.NN.GX.China"); printf("\n----------------------------------------------------------------------------"); printf("\n\n"); }

void load() { char x; FILE *fp; struct note *load_point;

if( (fp=fopen("notesave.mmd","rb"))==NULL ) { printf("Creat a new notesave.mmd!\n"); if( (fp=fopen("notesave.mmd","wb"))==NULL) { printf("Sorry~Can not creat files!\n\n"); return; } printf("ok!\n"); fclose(fp); }

head_point=(struct note*)malloc(sizeof(struct note)); end_point=(struct note*)malloc(sizeof(struct note)); head_point->front_point=NULL; head_point->next_point=end_point; end_point->front_point=head_point; end_point->next_point=NULL;

strcpy(head_point->name,"HEAD"); strcpy(head_point->id,"HEAD"); strcpy(head_point->publisher,"HEAD"); strcpy(head_point->price,"HEAD"); strcpy(head_point->borrowname,"HEAD");

strcpy(end_point->name,"END"); strcpy(end_point->id,"END"); strcpy(end_point->publisher,"END"); strcpy(end_point->price,"END"); strcpy(end_point->borrowname,"END");

now_point=head_point;

while(fread(&x,1,1,fp),!feof(fp)) { fseek(fp,-1L,1); load_point=(struct note*)malloc(sizeof(struct note)); fread(load_point,sizeof(struct note),1,fp); load_point->next_point=now_point->next_point; load_point->front_point=now_point; now_point->next_point=load_point; now_point=load_point; }

fclose(fp); printf("Load files finished!\n"); return; }

void save() { FILE *fp; struct note *save_point; char words[256]; printf("It will change notesave.mmd file,are you sure?(yes/no)"); gets(words); if( (strcmp(words,"yes"))!= 0) { printf("drop action!\n\n"); return; } printf("Saving...\n"); if( (fp=fopen("notesave.mmd","wb"))==NULL ) { printf("Can't save files!\n"); return; }

save_point=head_point->next_point;

for(;save_point->next_point!=NULL;save_point=save_point->next_point) { fwrite(save_point,sizeof(struct note),1,fp); }

printf("Save finished!\n\n"); }

void uppoint() { if( now_point->front_point==head_point ) { printf("Sorry can not move TOP!\n\n"); return; }

printf("Trade record:"); show(now_point); show(now_point->front_point); trade(now_point->front_point,now_point); printf("Trade finished!\n\n"); }

void downpoint() { if( now_point->next_point==end_point ) { printf("Sorry can not move END!\n\n"); return; }

printf("Trade record:"); show(now_point); show(now_point->next_point); trade(now_point,now_point->next_point); printf("Trade finished!\n\n"); }

void trade(struct note *a_point,struct note *b_point) { a_point->front_point->next_point=b_point; b_point->next_point->front_point=a_point;

a_point->next_point=b_point->next_point; b_point->front_point=a_point->front_point;

a_point->front_point=b_point; b_point->next_point=a_point;

}

[此贴子已经被作者于2005-2-7 11:39:05编辑过]


----------------解决方案--------------------------------------------------------
  相关解决方案