⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tables.h

📁 小型图书馆管理系统
💻 H
字号:
#ifndef TABLE_H
#define TABLE_H
#include"password.h"

//+---------------------------------------------------------------------------+
//|                            报表子函数声明                                 |
//+---------------------------------------------------------------------------+

void Bargain(void);
void Value(void);
void Quantity(void);
void Cost(void);
void Business(void);
void BaValue(void);

//*****************************************************************************
//*                         Tables(统计报表)函数                            *
//*****************************************************************************

void Tables()
{
	int choice;
	
	while(1)
	{
		system("cls");
		cout<<endl<<endl<<endl<<endl;
		cout<<"                                 统计报表             "<<endl<<endl;
		cout<<"                             1. 图书销售情况          "<<endl<<endl;
		cout<<"                             2. 价值量排序            "<<endl<<endl;
		cout<<"                             3. 库存量排序            "<<endl<<endl;
		cout<<"                             4. 售价排序              "<<endl<<endl;
		cout<<"                             5. 销售量排序            "<<endl<<endl;
		cout<<"                             6. 销售额排序            "<<endl<<endl;
		cout<<"                             7. 返回主菜单            "<<endl<<endl;
		cin>>choice;
		cin.ignore();
	
		while(choice<1 && choice>7)
		{
			cout<<"                           请在数字1-7中选择:";
			cin>>choice;
			cin.ignore();
			cout<<endl;
		}

		switch(choice)
		{
			case 1: Bargain(); break;
			case 2: Value(); break;
			case 3: Quantity(); break;
			case 4: Cost(); break;
			case 5: Business(); break;
			case 6: BaValue(); break;
			case 7: return;
		}
	}
}

//+---------------------------------------------------------------------------+
//|                      Bargain(图书销售情况)函数                          |
//+---------------------------------------------------------------------------+

void Bargain(void)
{
	int choice;
	char select;
	
	system("cls");
	cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl;
	cout<<"                              请选择图书类型:"<<endl<<endl;
loope:
	cout<<"                 1.教育 2.军事 3.历史 4.文学 5.科技 6.娱乐 7.全部"<<endl;
	cin>>choice;
	cin.ignore();
	
	while(choice<1 || choice>7)
	{
		cout<<"                             请在1-7中选择:";
		cin>>choice;
		cin.ignore();
		cout<<endl;
	}
	system("cls");
	cout<<endl;
	for(int i=1,playtime=0;i<max;i++)
	{
		if(choice==7)
		{
			cout<<endl<<"                    书号:"<<Book[i].getNum()<<endl;
			cout<<"                    书名:"<<Book[i].getTitle()<<endl;
			cout<<"                    作者:"<<Book[i].getAuthor()<<endl;
			cout<<"                  出版社:"<<Book[i].getPub()<<endl;
			cout<<"                    售价:"<<Book[i].getCost()<<"元"<<endl;
			cout<<"                总进货量:"<<Book[i].getTot()<<"本"<<endl;
			cout<<"                  库存量:"<<Book[i].getQty()<<"本"<<endl;
			cout<<"                总售出量:"<<Book[i].getTot()-Book[i].getQty()<<"本"<<endl;
			cout<<"                总销售额:"<<Book[i].getCost()*(Book[i].getTot()-Book[i].getQty())<<"元"<<endl;
			if(++playtime%2==0)
			{
				cout<<"                  请按回车键继续。"<<endl;
				cin.get();
			}          //计数翻页
			continue;
		}
		else if(Book[i].getKind()==choice)
		{
			cout<<endl<<"                   书号:"<<Book[i].getNum()<<endl;
			cout<<"                    书名:"<<Book[i].getTitle()<<endl;
			cout<<"                    作者:"<<Book[i].getAuthor()<<endl;
			cout<<"                  出版社:"<<Book[i].getPub()<<endl;
			cout<<"                    售价:"<<Book[i].getCost()<<"元"<<endl;
			cout<<"                总进货量:"<<Book[i].getTot()<<"本"<<endl;
			cout<<"                  库存量:"<<Book[i].getQty()<<"本"<<endl;
			cout<<"                总售出量:"<<Book[i].getTot()-Book[i].getQty()<<"本"<<endl;
			cout<<"                总销售额:"<<Book[i].getCost()*(Book[i].getTot()-Book[i].getQty())<<"元"<<endl;
			if(++playtime%2==0)
			{
				cout<<"                       请按回车键继续。"<<endl;
				cin.get();
			}          //计数翻页
		}
	}
	cout<<endl<<"                 显示完毕,是否显示其它类型图书?(Y/N)"<<endl;
	cin>>select;
	select=toupper(select);
	cin.ignore();

	while(select!='Y' && select!='N')
	{
		cout<<"                  是否显示其它类型图书?(Y/N)"<<endl;
		cin>>select;
		select=toupper(select);
		cin.ignore();
	}

	if(select=='Y')
	{
		system("cls");
		cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl;
		goto loope;
	}
}

//+---------------------------------------------------------------------------+
//|                        Value(价值量排序)函数                            |
//+---------------------------------------------------------------------------+

void Value(void)
{
	Valsort(1,max-1);
	system("cls");
	cout<<endl;
			
	for(int i=1,playtime=0;i<max;i++)
	{
		cout<<endl<<"                    书号:"<<Book[i].getNum()<<endl;
		cout<<"                    书名:"<<Book[i].getTitle()<<endl;
		cout<<"                    类型:";
				
		switch(Book[i].getKind())
		{
			case 1: cout<<"教育"; break;
			case 2: cout<<"军事"; break;
			case 3: cout<<"历史"; break;
			case 4: cout<<"文学"; break;
			case 5: cout<<"科技"; break;
			case 6: cout<<"娱乐"; break;
		}
				
		cout<<endl;
		cout<<"                  库存量:"<<Book[i].getQty()<<"本"<<endl;
		cout<<"                    售价:"<<Book[i].getCost()<<"元"<<endl;
		cout<<"                总价值量:"<<Book[i].getCost()*Book[i].getQty()<<"元"<<endl;  
		if(++playtime%3==0)
		{
			cout<<"                       请按回车键继续。"<<endl;
			cin.get();
		}
	}
	cout<<"                  显示完毕,按回车键确认!"<<endl;
	cin.get();
}

//+---------------------------------------------------------------------------+
//|                       Quantity(库存量排序)函数                          |
//+---------------------------------------------------------------------------+

void Quantity(void)
{
	Qtysort(1,max-1);
	system("cls");
	cout<<endl;
	
	for(int i=1,playtime=0;i<max;i++)
	{
		cout<<endl<<"                    书号:"<<Book[i].getNum()<<endl;
		cout<<"                    书名:"<<Book[i].getTitle()<<endl;
		cout<<"                    类型:";
				
		switch(Book[i].getKind())
		{
			case 1: cout<<"教育"; break;
			case 2: cout<<"军事"; break;
			case 3: cout<<"历史"; break;
			case 4: cout<<"文学"; break;
			case 5: cout<<"科技"; break;
			case 6: cout<<"娱乐"; break;
		}
			
		cout<<endl;
		cout<<"                  库存量:"<<Book[i].getQty()<<"本"<<endl;
		cout<<"                    售价:"<<Book[i].getCost()<<"元"<<endl;
		cout<<"                总价值量:"<<Book[i].getCost()*Book[i].getQty()<<"元"<<endl;  
		if(++playtime%3==0)
		{
			cout<<"                       请按回车键继续。"<<endl;
			cin.get();
		}
	}
	cout<<"                  显示完毕,按回车键确认!"<<endl;
	cin.get();
}

//+---------------------------------------------------------------------------+
//|                          Cost(售价排序)函数                             |
//+---------------------------------------------------------------------------+

void Cost(void)
{
	Costsort(1,max-1);
	system("cls");
	cout<<endl;
	
	for(int i=1,playtime=0;i<max;i++)
	{
		cout<<endl<<"                    书号:"<<Book[i].getNum()<<endl;
		cout<<"                    书名:"<<Book[i].getTitle()<<endl;
		cout<<"                    类型:";
			
		switch(Book[i].getKind())
		{
			case 1: cout<<"教育"; break;
			case 2: cout<<"军事"; break;
			case 3: cout<<"历史"; break;
			case 4: cout<<"文学"; break;
			case 5: cout<<"科技"; break;
			case 6: cout<<"娱乐"; break;
		}
				
		cout<<endl;
		cout<<"                  库存量:"<<Book[i].getQty()<<"本"<<endl;
		cout<<"                    售价:"<<Book[i].getCost()<<"元"<<endl;
		cout<<"                总价值量:"<<Book[i].getCost()*Book[i].getQty()<<"元"<<endl;  
		if(++playtime%3==0)
		{
			cout<<"                       请按回车键继续。"<<endl;
			cin.get();
		}
	}
	cout<<"                  显示完毕,按回车键确认!"<<endl;
	cin.get();
}

//+---------------------------------------------------------------------------+
//|                       Business(销售量排序)函数                          |
//+---------------------------------------------------------------------------+

void Business(void)
{
	Busort(1,max-1);
	system("cls");
	cout<<endl;
	
	for(int i=1,playtime=0;i<max;i++)
	{
		cout<<endl<<"                    书号:"<<Book[i].getNum()<<endl;
		cout<<"                    书名:"<<Book[i].getTitle()<<endl;
		cout<<"                    类型:";
			
		switch(Book[i].getKind())
		{
			case 1: cout<<"教育"; break;
			case 2: cout<<"军事"; break;
			case 3: cout<<"历史"; break;
			case 4: cout<<"文学"; break;
			case 5: cout<<"科技"; break;
			case 6: cout<<"娱乐"; break;
		}
				
		cout<<endl;
		cout<<"                  库存量:"<<Book[i].getQty()<<"本"<<endl;
		cout<<"                    售价:"<<Book[i].getCost()<<"元"<<endl;
		cout<<"                  销售量:"<<Book[i].getTot()-Book[i].getQty()<<"本"<<endl;  
		if(++playtime%3==0)
		{
			cout<<"                       请按回车键继续。"<<endl;
			cin.get();
		}
	}
	cout<<"                  显示完毕,按回车键确认!"<<endl;
	cin.get();
}

//+---------------------------------------------------------------------------+
//|                       BaValue(销售量排序)函数                           |
//+---------------------------------------------------------------------------+

void BaValue(void)
{
	BaValsort(1,max-1);
	system("cls");
	cout<<endl;
	
	for(int i=1,playtime=0;i<max;i++)
	{
		cout<<endl<<"                    书号:"<<Book[i].getNum()<<endl;
		cout<<"                    书名:"<<Book[i].getTitle()<<endl;
		cout<<"                    类型:";
			
		switch(Book[i].getKind())
		{
			case 1: cout<<"教育"; break;
			case 2: cout<<"军事"; break;
			case 3: cout<<"历史"; break;
			case 4: cout<<"文学"; break;
			case 5: cout<<"科技"; break;
			case 6: cout<<"娱乐"; break;
		}
				
		cout<<endl;
		cout<<"                  销售量:"<<Book[i].getTot()-Book[i].getQty()<<"本"<<endl;
		cout<<"                    售价:"<<Book[i].getCost()<<"元"<<endl;
		cout<<"                  销售额:"<<Book[i].getCost()*(Book[i].getTot()-Book[i].getQty())<<"元"<<endl;  
		if(++playtime%3==0)
		{
			cout<<"                       请按回车键继续。"<<endl;
			cin.get();
		}
	}
	cout<<"                  显示完毕,按回车键确认!"<<endl;
	cin.get();
}
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -