• 回答数

    4

  • 浏览数

    184

会舞蹈的兔子
首页 > 期刊论文 > 基于c语言的图书管理系统论文

4个回答 默认排序
  • 默认排序
  • 按时间排序

王子麻麻

已采纳

上次百度了一个,我看看啊

165 评论

肖小月半仔

#include #include #include #include //输入/输出文件流类 using namespace std; const int Maxr=100;//最多的读者 const int Maxb=100;//最多的图书 const int Maxbor=5;//每位读者最多借五本书 //读者类,实现对读者的信息的描述 class Reader { private: int tag; //删除标记 1:已删 0:未删 int no; //读者编号 char name[10]; //读者姓名 int borbook[Maxbor];//所借图书 public: Reader() {} char *getname() //获取姓名 int gettag() //获取删除标记 int getno() //获取读者编号 void setname(char na[]) //设置姓名 { strcpy(name,na); } void delbook()//设置删除标记 1:已删 0:未删 void addreader(int n,char *na)//增加读者 { tag=0; no=n; strcpy(name,na); for(int i=0;i> choice; switch (choice) { case '1': cout << "输入读者编号:"; cin >> readerid; cout << "输入读者姓名:"; cin >> rname; addreader (readerid,rname); break; case '2': cout << "输入读者编号:"; cin >> readerid; r=query(readerid); if (r==NULL) { cout << " 该读者不存在 "<> rname; r->setname(rname); break; case '3': cout << " 输入读者编号:"; cin >> readerid; r=query(readerid); if (r==NULL) { cout <<" 该读者不存在" << endl; break; } r->delbook(); break; case '4': cout << "读入读者编号:"; cin >> readerid; r=query(readerid); if (r==NULL) { cout <<"该读者不存在"<< endl; break; } r->disp(); break; case '5': disp(); break; case '6': clear(); break; default:cout<<"输入错误,请从新输入:";break; } } } //图书类,实现对图书的描述,图书的编号,书名,借出,还入等 class Book { private: int tag;//删除标记 1:已删 0:未删 int no;//图书编号 char name[20];//书名 int onshelf;//是否再架 1:再架 2:已借 public: Book(){} char *getname() //获取姓名 int getno()//获取图书编号 int gettag()//获取删除标记 void setname(char na[])//设置书名 { strcpy(name,na); } void delbook()//删除图书 void addbook(int n,char *na)//增加图书 { tag=0; no=n; strcpy(name,na); onshelf=1; } int borrowbook()//借书操作 { if (onshelf==1) { onshelf=0; return 1; } return 0; } void retbook()//还书操作 { onshelf=1; } void disp()//输出图书 { cout << setw(6) << no << setw(18) << name << setw(10) <<(onshelf==1? "在架":"已借") <> choice; switch (choice) { case '1': cout << "输入图书编号:"<> bookid; cout << "输入图书书名:"<> bname; addbook(bookid,bname); break; case '2': cout << "输入图书编号:"<> bookid; b=query(bookid); if (b==NULL) { cout << " 该图书不存在 "<> bname; b->setname(bname); break; case '3': cout <<" 读入图书编号:"<> bookid; b=query(bookid); if (b==NULL) { cout <<" 该图书不存在" << endl; break; } b->delbook(); break; case '4': cout << " 读入图书编号:"<> bookid; b=query(bookid); if (b==NULL) { cout <<" 该图书不存在"<< endl; break; } b->disp(); break; case '5': disp(); break; case '6': clear(); break; default:cout<<"输入错误,请从新输入:"; } } } //main() 函数的实现,程序的主界面的引导 void main() { char choice; int bookid,readerid; RDatabase ReaderDB; Reader *r; BDatabase BookDB; Book *b; while(choice!='0') { cout <> choice; switch (choice) { case '1': cout <<" 借书 读者编号:"; cin >>readerid; cout <<" 图书编号: "; cin >>bookid; r=(readerid);//按编号查找 if (NULL==r) { cout <<" 不存在该读者,不能借书"<< endl; break; } b=(bookid); if (b==NULL) { cout <<" 不存在该图书,不能借书"<< endl; break; } if (b->borrowbook()==0) { cout << " 该图书已借出,不能借书"<< endl; break; } r->borrowbook(b->getno()); break; case '2': cout<<"还书\n 读者编号:"; cin >>readerid; cout << " 图书编号:"; cin >>bookid; r=(readerid); if (r==NULL) { cout <<" 不存在该读者,不能还书" << endl; break; } b=(bookid); if (b==NULL) { cout <<" 不存在该图书,不能还书" <retbook(); r->retbook(b->getno()); break; case '3': (); break; case '4': (); break; default:cout<<"输入错误,请从新输入:"; } } }

169 评论

百叶书店

#include ""#include<>#include ""#include<>#include<>#include ""#include<>#include<>FILE *fp,*p ;void *buf=NULL;void main(){ void adm1(),adm2(),build(),huan(),borrow(),dele(),kaiji(); void anniu(int x1,int y1,int x2,int y2,int color,char *f); void no(); int d=VGA,m=VGAHI; initgraph(&d,&m,""); setmouse(0,629,0,459); settextstyle(3,0,1); kaiji(); buf=jiantou(buf); adm1(); adm2();}void adm1(){ char adp[20],password[20]; int i,n=0; textbackground(2); cleardevice(); fp=fopen("pass","r"); if(fp==NULL) { outtext("no exit ");getch();exit(0);} for(;;) { setcolor(2); anniu(150,1,300,20,0," "); setcolor(15); outtext("input password:"); gotoxy(20,1);gets(adp); for(i=0;adp[i]!='\0';i++); if(i==0) exit(0); fgets(password,i+1,fp); if(strcmp(password,adp)==0) { cleardevice();outtext("YES");getch();adm2();} else{ n++; cleardevice();outtext("error"); for(i=0;i<10;i++) delay(8000); if(n==2) { cleardevice(); outtext("once again");for(i=0;i<=10;i++) delay(8000);} if(n==3) { cleardevice(); outtext("3 second out");for(i=0;i<=10;i++) delay(8000); exit(0); } } fclose(fp);cleardevice(); }}void adm2() { char a; int i,j,x,y; clrscr(); cleardevice(); for(;;) { setbkcolor(6); setcolor(2); cleardevice(); anniu(12,40,190,70,15,"built a user (B)"); setcolor(2); anniu(12,90,190,120,15,"return book (R)"); setcolor(2); anniu(12,140,190,170,15,"borrow books (J)"); setcolor(2); anniu(12,190,190,220,15,"delete user (D)"); setcolor(2); anniu(12,240,190,270,15,"exit (E)"); do{ do{ i=readmouse(&x,&y,buf,1); ; int86(0x16,&r,&r); j=; if(j!=0) switch(j){ case 0x30:a='b';break; case 0x13:a='r';break; case 0x24:a='j';break; case 0x20:a='d';break; case 0x12:a='e';break; } } while(i!=1&&j==0); if((x>12&&x<190&&y>40&y<70&&i==1)||a=='b') { setcolor(2); anniu(12,40,190,70,2,"built a user (B)"); delay(80000); build(); } if((x>12&&x<190&&y>90&y<120&&i==1)||a=='r') { setcolor(2); anniu(12,90,190,120,2,"return book (R)"); delay(80000); huan(); } if((x>12&&x<190&&y>140&y<170&&i==1)||a=='j') {setcolor(2); anniu(12,140,190,170,2,"borrow books (J)"); delay(80000); borrow(); } if((x>12&&x<190&&y>190&y<220&&i==1)||a=='d') { setcolor(2); anniu(12,190,190,220,2,"delete user (D)"); delay(80000); dele(); } if((x>12&&x<190&&y>240&y<270&&i==1)||a=='e') {setcolor(2); anniu(12,240,190,270,2,"exit (E)"); closegraph(); showBMP(""); for(i=0;i<100;i++)delay(10000); exit(0); } i=0;j=0; }while(i==0&&j==0); } }void anniu(int x1,int y1,int x2,int y2,int color,char *f) { setfillstyle(1,color); rectangle(x1,y1,x2,y2); floodfill(x1+1,y1+1,2); setcolor(1); outtextxy(20,y1+10,f); }void build() { FILE *f; char id[20],name[20],sex[2],age[3],grad[50]; cleardevice(); printf("ID number:"); scanf("%s",id); printf("name:"); scanf("%s",name); printf("sex:"); scanf("%s",sex); printf("grad:"); scanf("%s",grad); p=fopen(id,"w+"); if(p==NULL) { no("can't build it");getch();adm2();} fprintf(p,"%s ",name); fprintf(p,"%s ",id); fprintf(p,"%s ",sex); fprintf(p,"%s ",grad); no("bulid success"); getch(); fclose(p); adm2(); }void huan(){ FILE *fp,*p; char id[20],a[5][50],name[20],c; int i=0,m,k; cleardevice(); printf("input ID number:"); scanf("%s",id); p=fopen(id,"r"); if(p==NULL) { no("user no exit");getch();fclose(p);adm2();} fscanf(p,"%s",name); fclose(p); fp=fopen(name,"r"); while(!feof(fp)){ fscanf(fp,"%s",a[i++]); } for(k=0;k=5); for(k=i;k

202 评论

烂Pandade

#include<>#include<>struct sale/*商品名的定义*/{int number;
char name[20];
float price;
long count;
long time;
long date;}; /*各个函数*/ void input(struct sale s[7]);/*输入函数*/ void output(struct sale s[7]);/*输出函数*/ void seek(struct sale s[7]);/*查找函数*/ void row(struct sale s[7]);/*排序函数*/ void change(struct sale s[7]);/*删除、修改、或插入*/void main()/*主函数执行区域*/{struct sale s[7]={{2,"pen",},{1,"milk",},{5,"coke",},{6,"chewing",},{4,"eraser",},{3,"pencil",}};/*定义初始值*/; /*input(s);【已付初始值暂不运行!!】*/output(s);seek(s);row(s);change(s); } /*void input(struct sale s[7])【注释:已付初始值,暂不运行!!】 {int i;
printf("请分别输入产品编号、名称、单价、库存数量、入库时间、有效日期:\n");
for(i=0;i<7;i++)
scanf("%d%s%f%ld%ld%ld",&);}*/void output(struct sale s[7])/*定义输出*/{int i;
printf("编号\t名称\t单价\t库存数量\t入库时间\t\t有效日期\n");
for(i=0;i<7;i++)
printf("%d\t%s\t%.2f\t%ld\t\t%ld\t\t%ld\n",);} void seek(struct sale s[7])/*定义查找*/ {int i;
int m;
int k;
k=1;
printf("请输入要查找的编号\n");
printf("m== ");
scanf("%d",&m);
for(i=0;i<7;i++)
{
if(m==)
{printf("你想查找的物品是:\n");
printf("编号\t名称\t单价\t库存数量\t入库时间\t\t有效日期\n");
printf("%d\t%s\t%.2f\t%ld\t\t%ld\t\t%ld\n",);
k=m;} } if(k==1) printf("没有此类商品!!!\n"); }void row(struct sale s[7])/*排序*/ { struct sale t; int i,j; int m,a; printf("\n"); printf("输出已排好序的商品\n"); for(j=0;j<6;j++) for(i=0;i<6-j;i++) if(>) { t=s; s=s; s=t; } printf("重新排序后是; \n"); printf("编号\t名称\t单价\t库存数量\t入库时间\t\t有效日期\n"); for(a=0;a<7;a++) printf("%d\t%s\t%.2f\t%ld\t\t%ld\t\t%ld\n",s[a].number,s[a].name,s[a].price,s[a].count,s[a].time,s[a].date); }void change(struct sale s[7])/*删除、修改、或插入*/ { struct sale c; int i,m,q,n,k; k=0; printf("请输入您要删除、修改或要插入的物品编号\n");/*前奏*/ scanf("%d",&m); for(i=0;i<7;i++) if(m==) {{printf("编号\t名称\t单价\t库存数量\t入库时间\t\t有效日期\n");
printf("%d\t%s\t%.2f\t%ld\t\t%ld\t\t%ld\n",);} printf("你确实要删除它么???还是要修改??\n"); printf("如果想删除请输入1,如果要修改请输入2。\n"); printf("您要输入的是: "); scanf("%d",&q); if(q==1)/*执行删除命令*/ {printf("您删除后的结果是:\n");
for(i=0;i<7;i++)
if(m!=)
{printf("编号\t名称\t单价\t库存数量\t入库时间\t\t有效日期\n");
printf("%d\t%s\t%.2f\t%ld\t\t%ld\t\t%ld\n",);}} if(q==2)/*执行修改命令*/ {printf("输入你想修改的库存数量: ");
scanf("%d",&n);
s[m].count=n;
printf("修改后的商品信息为:\n");
printf("编号\t名称\t单价\t库存数量\t入库时间\t\t有效日期\n");
for(i=0;i<7;i++)
printf("%d\t%s\t%.2f\t%ld\t\t%ld\t\t%ld\n",);} k=i; } if(k==0)/*执行插入命令*/ {printf("\n\n");
printf("由于插入语句没有要求,所以插入语句尚未完成,有些功能尚未完善,所以会有错误,请老师见谅。\n\n\n");
printf("此类商品不存在,请插入\n");
printf("请分别输入要插入产品的编号、名称、单价、库存数量、入库时间、有效日期:\n");
i=m-1;
scanf("%d%s%f%ld%ld%ld",&);
printf("编号\t名称\t单价\t库存数量\t入库时间\t\t有效日期\n");
printf("%d\t%s\t%.2f\t%ld\t\t%ld\t\t%ld\n",);
for(i=0;i<7;i++)
printf("%d\t%s\t%.2f\t%ld\t\t%ld\t\t%ld\n",);


row(s);


}}这是我大一时候做的大作业,虽然不是图书管理系统,你只要改改就行了,原理都一样,呵呵

303 评论

相关问答

  • 基于c语言的图书管理系统论文

    上次百度了一个,我看看啊

    会舞蹈的兔子 4人参与回答 2023-12-11
  • 图书管理系统毕业论文前言

    在图书馆管理中,图书管理系统是图书室的核心管理系统,是一个由人、计算机等组成的能进行管理信息收集、传递、加工、保存、维护和使用的系统。下面是我为大家整理的图书管

    吃要吃好的 3人参与回答 2023-12-09
  • 基于java图书管理系统论文

    如果是毕业论文管理系统,可以从题目管理,任务书管理,评分|成绩管理,答辩组管理,评委管理,学生信息管理,通知公告管理等功能角度分析设计与开发。如果是图书管理系统

    真水岂无香 5人参与回答 2023-12-08
  • 基于vc的管理系统毕业论文

    ,我当时做的是一个网站,弄个主页再弄几个副页,主要是弄的漂亮一点,在找个懂asp的同学给弄个留言板。网站上的内容丰富点,素材漂亮点就差不多。当时我们辅导员给我们

    阳光通宝 3人参与回答 2023-12-09
  • 基于ssm的酒店管理系统论文

    性价比+服务优势调查结果显示,商务人士在选择酒店看中价格,却更关注酒店的服务管理以及住宿的舒适程度。那些仅靠价格优势而不重视服务质量的“小投入”旅店已经不能满足

    多儿的妈咪 7人参与回答 2023-12-08