C++课程设计--图书馆借阅系统(MFC)

课设题目

图书馆借阅系统

课设要求

设计内容
    某图时馆的图书资料有两种类型:图书和杂志:读者有两类:教师和学生。使用文本文件存储图书资料和读者信息。山图书管理员输入借书证号、资料编号等进行日常的图书借阅、妇还业务。主要功能包括:

  1. 用户管理
  2. 图书基本信息(书名, 条码,内部分类号,作者,库存量),杂志基本信息(书名、条码,卷号,库存量),教师和学生基本信息(姓名、借书证号)的录入、删除、修改和保存
  3. 图书资料和读者信息录入,包括手工录入和文件导入两种方式
  4. 借书和还书的业务(要求学生至多可借3本图书和S本杂志:教师可最多借5本图书和10本杂志)
  5. 读者可随时查看自己当前的做书情况
  6. 馆藏图书资料的查询和统计
  7. 资料信息、读者信息和报表的导出

程序运行界面

在这里插入图片描述
在这里插入图片描述

部分源码

void CLibraryView::OnInitialUpdate()
{
	CFormView::OnInitialUpdate();
	GetParentFrame()->RecalcLayout();
	ResizeParentToFit();

DWORD dwStyle1=m_bookshow.GetExtendedStyle();
	dwStyle1 |=LVS_EX_GRIDLINES|LVS_EX_FULLROWSELECT|LVS_EX_CHECKBOXES;
	m_bookshow.SetExtendedStyle(dwStyle1);
	m_bookshow.InsertColumn(0,_T("书名"),0,100);
	m_bookshow.InsertColumn(1,_T("条码"),0,100);
	m_bookshow.InsertColumn(2,_T("作者"),0,100);
	m_bookshow.InsertColumn(3,_T("库存量"),0,100);



	DWORD dwStyle2=m_magazineshow.GetExtendedStyle();
	dwStyle2 |=LVS_EX_GRIDLINES|LVS_EX_FULLROWSELECT|LVS_EX_CHECKBOXES;
	m_magazineshow.SetExtendedStyle(dwStyle2);
	m_magazineshow.InsertColumn(0,_T("书名"),0,100);
	m_magazineshow.InsertColumn(1,_T("卷号"),0,100);
	m_magazineshow.InsertColumn(2,_T("条码"),0,100);
	m_magazineshow.InsertColumn(3,_T("库存量"),0,100);
DWORD dwStyle3=m_teachershow.GetExtendedStyle();
		dwStyle3 |=LVS_EX_GRIDLINES|LVS_EX_FULLROWSELECT|LVS_EX_CHECKBOXES;
	m_teachershow.SetExtendedStyle(dwStyle3);
	m_teachershow.InsertColumn(0,_T("姓名"),0,70);
	m_teachershow.InsertColumn(1,_T("借书证号"),0,100);
	
DWORD dwStyle4=m_studentshow.GetExtendedStyle();
		dwStyle4 |=LVS_EX_GRIDLINES|LVS_EX_FULLROWSELECT|LVS_EX_CHECKBOXES;
	m_studentshow.SetExtendedStyle(dwStyle4);
	m_studentshow.InsertColumn(0,_T("姓名"),0,70);
	m_studentshow.InsertColumn(1,_T("借书证号"),0,100);
}
void CLibraryView::OnButton1() //资料手动导入
{
	// TODO: Add your control notification handler code here

	UpdateData();
	CLibraryDoc *p=GetDocument();
	if(m_book!=1)
	{
		bookset a;
		if(IDOK==a.DoModal())
		{
			UpdateData();
			strncpy(p->book[p->bookpos].name,(LPCTSTR)a.m_bookname,sizeof(p->book[p->bookpos].name));
			strncpy(p->book[p->bookpos].zuozhe,(LPCTSTR)a.m_zuozhe,sizeof(p->book[p->bookpos].zuozhe));
			p->book[p->bookpos].num=a.m_num;
			p->book[p->bookpos].tiaoma=a.m_tiaoma;
			p->bookpos++;
		}else
		{

		MessageBox("您取消了录入");
		}
	}
	else
	{
		magazineset a;
		if(IDOK==a.DoModal())
		{UpdateData();
		strncpy(p->maganize[p->magznizepos].name,(LPCTSTR)a.m_magazinename,sizeof(p->maganize[p->magznizepos].name));
		p->maganize[p->magznizepos].jvanhao=a.m_jvanhao;
		p->maganize[p->magznizepos].num=a.m_num;
		p->maganize[p->magznizepos].tiaoma=a.m_tiaoma;
		p->magznizepos++;

		}else
		{

		MessageBox("您取消了录入");
		}
	}
}

void CLibraryView::OnButton6() //读者
{
	// TODO: Add your control notification handler code here
	UpdateData();
	CLibraryDoc *p=GetDocument();
	if(m_teacher!=1)
	{
	inforset a;
	if(IDOK==a.DoModal())
	{
		p->teacher[p->teacherpos].id=a.m_id;
	strncpy(p->teacher[p->teacherpos].name,(LPCTSTR)a.m_name,sizeof(p->teacher[p->teacherpos].name));
	p->teacherpos++;

	}
	else
	{
	MessageBox("您取消了录入");
	}
	}
	else
	{

	inforset a;
	if(IDOK==a.DoModal())
	{
			p->student[p->studentpos].id=a.m_id;
	strncpy(p->student[p->studentpos].name,(LPCTSTR)a.m_name,sizeof(p->student[p->studentpos].name));
	p->studentpos++;
	}
	else
	{
	MessageBox("您取消了录入");
	}

	}
}

void CLibraryView::OnButton18() //信息显示
{
	// TODO: Add your control notification handler code here
		CLibraryDoc *p=GetDocument();
		m_bookshow.DeleteAllItems();
		m_magazineshow.DeleteAllItems();
		m_teachershow.DeleteAllItems();
		m_studentshow.DeleteAllItems();
		for(int i=0;i<p->bookpos;i++)
		{
			CString z,x,c,v;
			z.Format("%s",p->book[i].name);
			x.Format("%d",p->book[i].tiaoma);
			c.Format("%s",p->book[i].zuozhe);
			v.Format("%d",p->book[i].num);
			m_bookshow.InsertItem(i,z);
			m_bookshow.SetItemText(i,1,x);
			m_bookshow.SetItemText(i,2,c);
			m_bookshow.SetItemText(i,3,v);
		}
		for( i=0;i<p->magznizepos;i++)
		{
			CString z,x,c,v;
			z.Format("%s",p->maganize[i].name);
			x.Format("%d",p->maganize[i].jvanhao);
			c.Format("%d",p->maganize[i].tiaoma);
			v.Format("%d",p->maganize[i].num);
			m_magazineshow.InsertItem(i,z);
			m_magazineshow.SetItemText(i,1,x);
			m_magazineshow.SetItemText(i,2,c);
			m_magazineshow.SetItemText(i,3,v);
		}
		for( i=0;i<p->teacherpos;i++)
		{
			CString z,x;
			z.Format("%s",p->teacher[i].name);
			x.Format("%d",p->teacher[i].id);
			m_teachershow.InsertItem(i,z);
			m_teachershow.SetItemText(i,1,x);
		}
		for( i=0;i<p->studentpos;i++)
		{
			CString z,x;
			z.Format("%s",p->student[i].name);
			x.Format("%d",p->student[i].id);
			m_studentshow.InsertItem(i,z);
			m_studentshow.SetItemText(i,1,x);
		}
}

项目源码

需要源码的小伙伴请前往
微信公众号:海轰Pro
回复: 海轰
O(∩_∩)O哈哈~

发布了155 篇原创文章 · 获赞 110 · 访问量 5万+

猜你喜欢

转载自blog.csdn.net/weixin_44225182/article/details/104046456