导航:首页 > 源码编译 > mfc图书管理系统源码

mfc图书管理系统源码

发布时间:2022-01-12 03:00:44

㈠ Visual Studio 2010设计的图书管理系统 完整的 源代码

你好!!

我有一个图书管理系统,你看看吧,希望能帮到你,内涵建库脚本

㈡ 求C++链表写的图书管理系统或者其的MFC版源代码

这个不难,可以帮你

㈢ 求图书馆管理系统C++源代码

#include<iostream>
#include<fstream>
#include<windows.h>
#include<stdlib.h>
using namespace std;
void mainmenu();
void Manage_Book();
void input_Book();
void input_Reader();
void New_Book();
void Seek_Book();
void Borrow_Manage();
void Borrow_Book();
void Return_Book();
void Output_Message();
void Exit_System();
int u,v=3,k=0;
struct Book
{
char name[20];
int booknumber;
int num_present;
int num_all;
}book[1000];
struct Reader
{
char name[20];
int readernumber;
int card;
}reader[3];
void mainmenu()
{
int Num_Choice1,flag=1;
system("color E");
for(;k<=0;k++)
{
input_Book();
input_Reader();
}
while(flag==1)
{
system("cls");
cout<<"\t\t\t◆◆◆◆◆主菜单◆◆◆◆◆"<<endl
<<"\t\t\t☆ 1.图书管理 ☆"<<endl
<<"\t\t\t☆ 2.借阅管理 ☆"<<endl
<<"\t\t\t☆ 3.输出信息 ☆"<<endl
<<"\t\t\t☆ 4.退出系统 ☆"<<endl
<<"\t\t\t◆◆◆◆◆◆◆◆◆◆◆◆◆"<<endl;
cout<<"请输入所需要的服务编码"<<endl;
cin>>Num_Choice1;
switch(Num_Choice1)
{
case 1:
Manage_Book();
break;
case 2:
Borrow_Manage();
break;
case 3:
Output_Message();
break;
case 4:
Exit_System();
flag=0;
break;
default:
flag=0;
cout<<"输入有误!!"<<endl;
}
}
}
void Manage_Book()
{
int flag1=1,Num_Choice2;
system("cls"); while(flag1==1)
{
cout<<"\t\t\t◆◆◆◆◆◆◆◆◆◆◆◆◆"<<endl
<<"\t\t\t☆ 1.新书入库 ☆"<<endl
<<"\t\t\t☆ 2.图书查询 ☆"<<endl
<<"\t\t\t☆ 3.返回主菜单 ☆"<<endl
<<"\t\t\t◆◆◆◆◆◆◆◆◆◆◆◆◆"<<endl;
cin>>Num_Choice2;
switch(Num_Choice2)
{
case 1:
flag1=2;
New_Book();
break;
case 2:
flag1=2;
Seek_Book();
break;
case 3:
mainmenu();
default:
flag1=1;
cout<<"输入有误!"<<endl;
system("pause");
system("cls");
}
}}
void input_Book()
{
cout<<"请依照提示输入现有的三本图书的信息:"<<endl;
for(int i=0;i<3;i++)
{
cout<<"书名:"<<endl;
cin>>book[i].name;
cout<<"书号:"<<endl;
cin>>book[i].booknumber;
cout<<"库存量:"<<endl;
cin>>book[i].num_all;
cout<<"现存量:"<<endl;
cin>>book[i].num_present;
}
}
void New_Book()
{
system("cls");
int j;
char newbook_name[20];
cout<<"请输入新书书名:"<<endl;
cin>>newbook_name;
for(j=0;j<1000;j++)
{
if(strcmp(newbook_name,book[j].name)==0)
{
book[j].num_all++;
book[j].num_present++;
break;
}
}
if(j==1000)
{
cout<<"请为此新书编号:"<<endl;
v++;
cin>>book[v].booknumber;
strcpy(book[v].name,newbook_name);
book[v].num_all=1;
book[v].num_present=1;
}
else cout<<"已有此书,库存量加一"<<endl;
system("pause");
}
void Seek_Book()
{
system("cls");
int k,booknumber;
cout<<"请输入所要查询的书号:"<<endl;
cin>>booknumber;
for(k=0;k<1000;k++)
{
if(book[k].booknumber==booknumber)
{
cout<<"书号:"<<booknumber<<endl;
cout<<"书名:"<<book[k].name<<endl;
cout<<"库存量:"<<book[k].num_all<<endl;
cout<<"现存量:"<<book[k].num_present<<endl;
system("pause");
break;
}
}
if(k==1000)
{
cout<<"未找到此书!!"<<endl;
system("pause");
}
}
void Borrow_Manage()
{
int flag=1;
system("cls");
int Num_Choice3;
while(flag==1)
{
cout<<"\t\t\t◆◆◆◆◆◆◆◆◆◆◆◆◆"<<endl
<<"\t\t\t☆ 1.借书登记 ☆"<<endl
<<"\t\t\t☆ 2.还书管理 ☆"<<endl
<<"\t\t\t☆ 3.返回主菜单 ☆"<<endl
<<"\t\t\t◆◆◆◆◆◆◆◆◆◆◆◆◆"<<endl;
cin>>Num_Choice3;
switch(Num_Choice3)
{
case 1:
flag=2;
Borrow_Book();
break;
case 2:
flag=2;
Return_Book();
break;
case 3:
mainmenu();
default:
flag=1;
cout<<"输入有误!!"<<endl;
system("pause");
}
system("cls");
}
}
void input_Reader()
{
system("cls");
cout<<"请依照提示输入现有的三位读者的信息:"<<endl;
for(int m=0;m<3;m++)
{
cout<<"姓名:"<<endl;
cin>>reader[m].name;
cout<<"编号:"<<endl;
cin>>reader[m].readernumber;
reader[m].card=0;
}
}
void Borrow_Book()
{
system("cls");
char reader_name[20];
int n,book_number;
cout<<"请输入读者姓名:"<<endl;
cin>>reader_name;
for(n=0;n<3;n++)
{
if(strcmp(reader_name,reader[n].name)==0)
{
if(reader[n].card!=0)
{
cout<<"已借书,不能再借,请按任意键返回"<<endl;
system("pause");
mainmenu();
}
else
break;
}
}
if(n==3)
{
cout<<"无此读者!输入有误!!按任意键返回主菜单"<<endl;
system("pause");
mainmenu();
}
cout<<"请输入所借图书书号:"<<endl;
cin>>book_number;
for(n=0;n<v;n++)
{
if(strcmp(reader_name,reader[n].name)==0)
reader[n].card=book_number;
}
for(n=0;n<v;n++)
{
if(book[n].booknumber==book_number)
{
if(book[n].num_present==0)
{
cout<<"该书已经被借完,请按任意键返回"<<endl;
system("pause");
for(n=0;n<v;n++)
{
if(strcmp(reader_name,reader[n].name)==0)
reader[n].card=0;
}
mainmenu();
}
else
{
book[n].num_present--;
cout<<"借书成功,请按任意键返回"<<endl;
system("pause");
break;
}
}
}
if(n==v)
{
for(n=0;n<v;n++)
{
if(strcmp(reader_name,reader[n].name)==0)
reader[n].card=0;
}
cout<<"所输入的书号不存在,请按任意键返回主菜单"<<endl;
system("pause");
mainmenu();
}
}void Return_Book()
{
system("cls");
int j;
char reader_name[20];
int book_number;
cout<<"请输入读者姓名:"<<endl;
cin>>reader_name;
for(j=0;j<3;j++)
{
if(strcmp(reader_name,reader[j].name)==0)
break;
}
if(j==3)
{
cout<<"无此读者!输入有误!!按任意键返回主菜单"<<endl;
system("pause");
mainmenu();
}
cout<<"请输入所还图书书号:"<<endl;
cin>>book_number;

for(j=0;j<3;j++)
{
if(strcmp(reader_name,reader[j].name)==0)
{
if(book_number==reader[j].card)
{
reader[j].card=0;
for(j=0;j<v;j++)
{
if(book[j].booknumber==book_number)
{
book[j].num_present++;
cout<<"还书成功,请按任意键返回"<<endl;
system("pause");
break;
}
}
}
else
{
cout<<"该读者未借此书"<<endl;
system("pause");
}
}
if(j==v)
cout<<"所输入的书号不存在:"<<endl;
}
}
void Output_Message()
{
system("cls");
int q;
cout<<"以下是图书信息"<<endl<<endl;
for(q=0;q<v;q++)
{
cout<<"书号:"<<book[q].booknumber<<'\t';
cout<<"书名:"<<book[q].name<<'\t';
cout<<"库存量:"<<book[q].num_all<<'\t';
cout<<"现存量:"<<book[q].num_present<<endl;
}
cout<<"以下是读者信息"<<endl<<endl;
for(q=0;q<3;q++)
{
cout<<"姓名:"<<reader[q].name<<'\t'
<<"编号:"<<reader[q].readernumber<<'\t'
<<"所借书号:"<<reader[q].card<<endl;
}
system("pause");
}
void Exit_System()
{
system("cls");
cout<<"欢迎下次使用,谢谢"<<endl;
system("pause");
}
void main()
{
mainmenu();
}

㈣ MFC 图书馆管理系统 完整程序

//主函数文件

#include<iostream>
#include<string>
#include"book.h"
#include"reader.h"
#include"Book_DBase.h"
#include"Reader_DBase.h"
#include"Login.h"
usingnamespacestd;

intmain()
{
intflag1,flag2;
intpos=-1;
charch;

stringzhanghao,mima;
Readerreader;

INit_Login();

do
{
cout<<"输入你的选择"<<endl;
cout<<"|||||||||||||||||||||||||||||||"<<endl;
cout<<"|1:登录2:学生注册3:退出|"<<endl;
cout<<"|||||||||||||||||||||||||||||||"<<endl;
cin>>flag1;

switch(flag1)
{
case1:
lp:cout<<"选择登录身份:"<<endl;
cout<<"|||||||||||||||||||||||||||||"<<endl;
cout<<"|1:学生2:管理员3:退出|"<<endl;
cout<<"|||||||||||||||||||||||||||||"<<endl;
cin>>flag2;

switch(flag2)
{
case1:
cout<<"输入帐号:";
cin>>zhanghao;

if(Search_the_ZH(zhanghao,pos))
{
loop:cout<<"输入密码:";
cin>>mima;

if(Search_the_MM(pos,mima))
{
if(RDase.Search_ZhangHao(zhanghao,reader))
Student_Manager(reader);
else
cout<<"拥有该该帐号的不存在"<<endl;
}
else
{
cout<<"密码错误,是否重新输入(Y/N)?"<<endl;
cin>>ch;
if(ch=='Y')
gotoloop;
}
}

else
{
cout<<"账号不存在"<<endl;
}
break;

case2:
cout<<"输入管理员专属帐号:";
cin>>zhanghao;

if(zhanghao!=Adminidtrator.Zhang_Hao)
{
cout<<"帐号无效,88"<<endl;
}
else
{
lop:cout<<"输入管理员密码:";
cin>>mima;

if(mima!=Adminidtrator.Mi_Ma)
{
cout<<"密码错误,是否重新输入(Y/N)?"<<endl;
cin>>ch;
if(ch=='Y')
gotolop;
}
else
{
Admin_Manager();
}
}
break;

case3:
cout<<"谢谢使用"<<endl;
break;
default:
cout<<"选择无效"<<endl;
gotolp;
}
break;

case2:
cout<<"|||||||||||||||||||||||||||"<<endl;
cout<<"|欢迎进入注册界面|"<<endl;
cout<<"|||||||||||||||||||||||||||"<<endl;

Register();

break;
case3:
cout<<"谢谢使用"<<endl;
break;
default:
cout<<"操作无效"<<endl;
}
}while(flag1!=3);

return0;
}

代码太多,无法粘贴,下载附件吧。

希望采纳!

㈤ 请问用VC开发一个图书管理系统的源代码值多少钱.

1000左右吧,一般找人写个这样的程序也就这个价左右

㈥ c++图书馆藏书管理系统源代码

#include"stdio.h"
#include"string.h"

struct book /*定义结构体*/
{ char number[20];
char name[20];
char press[20];
char writer[20];
int n; /*现有量*/
int m; /*总量*/
}a[10];
int b; /*输入书的数量*/

void input() /*输入图书信息函数*/
{
FILE *fp;
char str2[10]={" "};
int i;
if((fp=fopen("d:\\wen","w"))==NULL)
{ printf("Open failed\n");
return; }
printf("\nHow many books do you want to input?\n");
scanf("%d",&b);
for(i=0;i<b;i++)
{
printf("Enter the %d book's number name press writer now all\n",i+1);
scanf("%s%s%s%s%d%d",&a[i].number,&a[i].name,&a[i].press,&a[i].writer,&a[i].n,&a[i].m);
fwrite(&a[i],sizeof(struct book),1,fp);
}
fclose(fp);
}

void Search() /*查询书籍*/
{
FILE *fp;
int w,i; /*w查询方式使用的数据*/
char str[20]; /*查询书籍的编码书名出版社作者*/
if((fp=fopen("d:\\wen","r"))==NULL)
{ printf("Open failed\n");
return; }
for(i=0;i<b;i++)
if(fread(&a[i],sizeof(struct book),1,fp)!=1)
printf("file read error\n");
printf("search by number--6\n");
printf("search by name--7\n");
printf("search by writer--8\n");
printf("search by press--9\n");
scanf("%d",&w);
printf("Enter the word you want to search:\n");
scanf("%s",str);
switch(w)
{
case 6:
{for(i=0;i<b;i++)
if(strcmp(a[i].number,str)==0)
{printf("number: %s name: %s press: %s writer: %s now: %d all:%d\n",a[i].number,a[i].name,a[i].press,a[i].writer,a[i].n,a[i].m);
break;
}
}
break;
case 7:
{for(i=0;i<b;i++)
if(strcmp(a[i].name,str)==0)
{printf("number: %s name: %s press: %s writer: %s now: %d all:%d\n",a[i].number,a[i].name,a[i].press,a[i].writer,a[i].n,a[i].m);
break;}
}
break;
case 8:
{for(i=0;i<b;i++)
if(strcmp(a[i].press,str)==0)
{printf("number: %s name: %s press: %s writer: %s now: %d all:%d\n",a[i].number,a[i].name,a[i].press,a[i].writer,a[i].n,a[i].m);
break;}
}
break;
case 9:
{for(i=0;i<b;i++)
if(strcmp(a[i].writer,str)==0)
{ printf("number: %s name: %s press: %s writer: %s now: %d all:%d\n",a[i].number,a[i].name,a[i].press,a[i].writer,a[i].n,a[i].m);
break; }
}
}
fclose(fp);
}
void borrow() /*借阅图书函数*/
{ FILE *fp;
int i;
char xuehao[20],number2[20];
char jieyue[20]={"borrow:"};
if((fp=fopen("d:\\wen00.txt","w"))==NULL)
{ printf("Open failed\n");
return; }
printf("Enter your number:\n");
scanf("%s",xuehao);
printf("Enter the book's number which you want to borrow\n");
scanf("%s",number2);
for(i=0;i<10;i++)
if(strcmp(a[i].number,number2)==0)
if(a[i].n>0)
{a[i].n--;
printf("borrow sucess!\n");
if(fwrite(&xuehao[20],sizeof(xuehao[20]),1,fp)!=1)
printf("file write error\n");
if(fwrite(&jieyue[20],sizeof(jieyue),1,fp)!=1)
printf("file write error\n");
if(fwrite(&a[i],sizeof(struct book),1,fp)!=1)
printf("file write error\n");
break;
}
else
printf("borrow failed!");
fclose(fp);

}
void giveback() /*归还图书函数*/
{FILE *fp;
int i;
char xuehao[20],number2[20];
char guihuan2[20]={"give back"};
if((fp=fopen("d:\\wen00.txt","w"))==NULL)
{printf("cannot open file\n");
return;
}
printf("Enter your number:\n");
scanf("%s",xuehao);
printf("Enter the book's number which you want to give back\n");
scanf("%s",number2);
for(i=0;i<1000;i++)
if(strcmp(a[i].number,number2)==0)
{ if(fwrite(&xuehao[20],sizeof(xuehao),1,fp)!=1)
printf("file write error\n");
if(fwrite(&guihuan2[20],sizeof(guihuan2),1,fp)!=1)
printf("file write error\n");
if(fwrite(&a[i],sizeof(a[i]),1,fp)!=1)
printf("file write error\n");
break;
}
printf("give back sucess!\n");
fclose(fp);
}

void adddelet() /*增加删除功能*/
{ FILE *fp;
char number3[20];
int s,i,j,t; /*t为增加或删除 s增加书的数量*/
if((fp=fopen("d:\\wen00.txt","w"))==NULL)
{printf("cannot open file\n");
return ;
}
printf("Chose what you want to do:");
printf("add books--11\n");
printf("delet books--12\n");
scanf("%d",&t);
switch(t)
{
case 11:
{printf("Enter the book'number which you want to add:");
scanf("%s",number3);
printf("How many books do you want to add?:");
scanf("%d",&s);
for(i=0;i<10;i++)
if(strcmp(a[i].number,number3)==0)
a[i].m=a[i].m+s;
} break;
default :
{printf("Enter the book'number which you want to delet:");
scanf("%s",number3);
for(i=0;i<10;i++)
if(strcmp(a[i].number,number3)==0)
for(;i<10;i++)
{ for(j=0;j<20;j++)
a[i].number[j]=a[i+1].number[j];
for(j=0;j<20;j++)
a[i].name[j]=a[i+1].name[j];
for(j=0;j<20;j++)
a[i].press[j]=a[i+1].press[j];
for(j=0;j<20;j++)
a[i].writer[j]=a[i+1].writer[j];
a[i].n=a[i+1].n;
a[i].m=a[i+1].m;
}
}

}
fclose(fp);
}

void main() /*主函数*/
{
printf("Welcome to labrary!\nChose what you want to do:\n");
printf("Input book's information--1;\n");
printf("serach books--2;\n");
printf("borrow books--3;\n");
printf("add or delet books--4;\n");
printf("give back books--5;\n");
printf("quit--6;\n");
printf("Please chose zhe number:");
while(1)
{
switch(getchar())
{
case '1': input();break;
case '2': Search();break;
case '3': borrow() ;break;
case '4': adddelet();break;
case '5': giveback();break;

}
}
}

㈦ 急求vc++和sql数据库的图书馆管理系统源代码

1、用一台PC做数据库服务器---window xp professional 环境可以装sql2000个人版
2、交换机、网线将他们一些列PC组合成局域网
3、用VC++开发访问数据库的客户端程序,你可以采用ODBC或ADO数据接口,当采用数据接口时候,无需开发通讯模块
4、数台PC装有该VC++开发的数据库访问模块,当然可以设置不同的模块权限,构成一个分布式数据库访问操作网络

㈧ 图书管理系统C++ 源代码 求好心人帮帮忙

这种东西好多C++学习站都有下载!全是源码
易语言也有!

你可以去找找!很多的!

㈨ C++图书馆管理系统源代码

/*****************************************************************************************/
#include <iostream>
#include <iomanip>
#include <cstring>
#include <fstream>//输入/输出文件流类
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() {return name;} //获取姓名
int gettag() {return tag;} //获取删除标记
int getno() {return no;} //获取读者编号
void setname(char na[]) //设置姓名
{
strcpy(name,na);

}
void delbook(){ tag=1; }//设置删除标记 1:已删 0:未删
void addreader(int n,char *na)//增加读者
{
tag=0;
no=n;
strcpy(name,na);
for(int i=0;i<Maxbor;i++)
borbook[i]=0;
}
void borrowbook(int bookid)//借书操作
{
for(int i=0;i<Maxbor;i++)
{
if (borbook[i]==0)
{
borbook[i]=bookid;
return;

}
}

}
int retbook(int bookid)//还书操作
{
for(int i=0;i<Maxbor;i++)
{
if(borbook[i]==bookid)
{
borbook[i]=0;
return 1;

}
}
return 0;
}
void disp()//读出读者信息
{
cout << setw(5) << no <<setw(10) << name<<"借书编号:[";
for(int i=0;i<Maxbor;i++)
if(borbook[i]!=0)
cout << borbook[i] << "|";
cout << "]"<<endl;

}
};

//读者类库,实现建立读者的个人资料
class RDatabase
{
private:
int top; //读者记录指针
Reader read[Maxr];//读者记录
public:
RDatabase() //构造函数,将reader.txt读到read[]中
{
Reader s;
top=-1;
fstream file("reader.txt",ios::in);//打开一个输入文件
while (1)
{
file.read((char *)&s,sizeof(s));
if (!file)break;
top++;
read[top]=s;
}
file.close(); //关闭 reader.txt
}
void clear()//删除所有读者信息
{
top=-1;
}
int addreader(int n,char *na)//添加读者时先查找是否存在
{
Reader *p=query(n);
if (p==NULL)
{
top++;
read[top].addreader(n,na);
return 1;
}
return 0;

}
Reader *query(int readerid)//按编号查找
{
for (int i=0;i<=top;i++)
if (read[i].getno()==readerid &&
read[i].gettag()==0)
{
return &read[i];
}
return NULL;
}
void disp() //输出所有读者信息
{
for (int i=0;i<=top;i++)
read[i].disp();
}
void readerdata();//读者库维护
~RDatabase() //析构函数,将read[]写到reader.txt文件中
{
fstream file("reader.txt",ios::out);
for (int i=0;i<=top;i++)
if (read[i].gettag()==0)
file.write((char *)&read[i],sizeof(read[i]));
file.close();

}
};
void RDatabase::readerdata()
{

char choice;
char rname[20];
int readerid;
Reader *r;
while (choice!='0')
{
cout <<"\n\n\t\t\t读 者 维 护\n\n\n\t\t 1 新 增\n\n\t\t 2 更 改\n\n\t\t 3 删 除\n\n\t\t 4 查 找\n\n\t\t 5 显 示\n\n\t\t 6 全 删\n\n\t\t 0 退 出"<<endl;
cin >> 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 << " 该读者不存在 "<<endl;
break;
}
cout << "输入新的姓名:";
cin >> 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() { return name; }//获取姓名
int getno(){ return no; }//获取图书编号
int gettag(){ return tag; }//获取删除标记
void setname(char na[])//设置书名
{
strcpy(name,na);
}
void delbook(){ tag=1;}//删除图书
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? "在架":"已借") <<endl;
}
};

//图书库类,实现对图书的维护,查找,删除等
class BDatabase
{
private:
int top; //图书记录指针
Book book[Maxb]; //图书记录
public:
BDatabase()//构造函数,将book.txt读到book[]中
{
Book b;
top=-1;
fstream file("book.txt",ios::in);
while (1)
{
file.read((char *)&b,sizeof(b));
if (!file) break;
top++;
book[top]=b;
}
file.close();
}
void clear()//全删
{
top=-1;
}
int addbook(int n,char *na)//增加图书
{
Book *p=query(n);
if (NULL==p)
{
top++;
book[top].addbook(n,na);
return 1;
}
return 0;
}
Book *query(int bookid)//查找图书
{
for (int i=0;i<=top;i++)
if (book[i].getno()==bookid &&book[i].gettag()==0)
{
return &book[i];
}
return NULL;
}
void bookdata();//图书库维护
void disp()
{
for (int i=0;i<=top;i++)
if (book[i].gettag()==0)
book[i].disp();
}
~BDatabase()//析构函数,将book[]写到book.txt文件中
{
fstream file("book.txt",ios::out);
for (int i=0;i<=top;i++)
if (book[i].gettag()==0)
file.write((char *)&book[i],sizeof(book[i]));
file.close();
}
};
void BDatabase::bookdata()
{
char choice;
char bname[40];
int bookid;
Book *b;
while (choice!='0')
{
cout <<"\n\n\n\t\t\t图 书 维 护 "<<endl<<endl;
cout<<"\t\t1 新 增\n \t\t2 更 改\n\t\t3 删 除\n\t\t4 查 找\n\t\t5 显 示\n\t\t6 全 删\n\t\t0 退 出"<<endl;
cin >> choice;
switch (choice)
{
case '1':
cout << "输入图书编号:"<<endl;
cin >> bookid;
cout << "输入图书书名:"<<endl;
cin >> bname;
addbook(bookid,bname);
break;
case '2':
cout << "输入图书编号:"<<endl;
cin >> bookid;
b=query(bookid);
if (b==NULL)
{
cout << " 该图书不存在 "<<endl;
break;
}
cout << "输入新的书名:"<<endl;
cin >> bname;
b->setname(bname);
break;
case '3':
cout <<" 读入图书编号:"<<endl;
cin >> bookid;
b=query(bookid);
if (b==NULL)
{
cout <<" 该图书不存在" << endl;
break;
}
b->delbook();
break;
case '4':
cout << " 读入图书编号:"<<endl;
cin >> bookid;
b=query(bookid);
if (b==NULL)
{
cout <<" 该图书不存在"<< endl;
break;
}
b->disp();
break;
case '5':
disp();
break;
case '6':
clear();
break;
default:cout<<"输入错误,请从新输入:";
}
}
}

//main() 函数的实现,程序的主界面的引导

int main(void)
{
char choice;
int bookid,readerid;
RDatabase ReaderDB;
Reader *r;
BDatabase BookDB;
Book *b;
while(choice!='0')
{
cout <<endl<<endl<<"\t\t\t 图 书 管 理 系 统\n\n\n";

cout <<"\t\t\t1 借 书\n\n\t\t\t2 还 书 \n\n\t\t\t3 图 书 维 护\n\n\t\t\t4 读 者 维 护\n\n\t\t\t0 离 开"<<endl;
cin >> choice;
switch (choice)
{
case '1':
cout <<" 借书 读者编号:";
cin >>readerid;
cout <<" 图书编号: ";
cin >>bookid;
r=ReaderDB.query(readerid);//按编号查找
if (NULL==r)
{
cout <<" 不存在该读者,不能借书"<< endl;
break;
}
b=BookDB.query(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=ReaderDB.query(readerid);
if (r==NULL)
{
cout <<" 不存在该读者,不能还书" << endl;
break;
}
b=BookDB.query(bookid);
if (b==NULL)
{
cout <<" 不存在该图书,不能还书" <<endl;
break;
}
b->retbook();
r->retbook(b->getno());
break;
case '3':
BookDB.bookdata();
break;
case '4':
ReaderDB.readerdata();
break;
default:cout<<"输入错误,请从新输入:";

}
}
return 0;
}

㈩ 关于用MFC做图书管理系统,我用的是VS2010,有哪位大神可以给我一点代码参考

http://..com/question/572132452?&oldq=1#answer-1440648477

阅读全文

与mfc图书管理系统源码相关的资料

热点内容
androidtcpdump下载 浏览:220
python如何实现界面化 浏览:634
托管服务器如何定级 浏览:766
命令创建设备节点 浏览:892
劲舞团辅助源码论坛 浏览:279
春运在哪个app买机票便宜 浏览:688
南京程序员借钱 浏览:26
android拍照获取图片路径 浏览:556
pdf文件转换excel 浏览:546
湖南服务器安全云空间 浏览:607
文件夹是只读怎么办 浏览:895
linuxtelnet退出命令 浏览:248
税务局预交2算法 浏览:533
前馈pid算法 浏览:147
安卓怎么使用投影仪 浏览:940
云计算服务器贵州云主机 浏览:393
淘米APP是哪个公司 浏览:454
程序员玩车 浏览:476
安卓腾讯手游换成苹果手机怎么办 浏览:528
主播皮克桃玩的什么安卓区 浏览:567