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

📄 report.cpp

📁 C++课程设计 下载后就直接可以交了 呵呵 好动洗
💻 CPP
字号:
// Report.cpp: implementation of the Report class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "Sale.h"
#include "Report.h"
#include "string.h"
#include "iomanip.h"
struct Bookdata;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

void Report::inorderReport()
{
	cout<<setw(11)<<"ISBN 号 "<<setw(11)<<"书名   "<<setw(11)<<"作者 "<<setw(11)<<"出版社 "<<setw(11)<<"进书日期 "<<setw(5)<<"库存量 "<<setw(5)<<"批发价 "<<setw(5)<<"零售价 "<<endl;
	for(int n=1;n<=num;n++)
	{
	cout<<setw(11)<<book[n].isbn<<setw(11)<<book[n].bookTitle<<setw(11)<<book[n].author<<setw(11)<<book[n].publisher;
	cout<<setw(11)<<book[n].dateAdded<<setw(5)<<book[n].qtyOnHand<<setw(5)<<book[n].wholesale<<setw(5)<<book[n].retail<<endl;
	}
}

void Report::pifa()
{
	cout<<setw(11)<<"书名  "<<setw(5)<<"批发价 "<<endl;
	float sum=0;
	for(int temp=1;temp<=num;temp++)
	{
		
		cout<<setw(11)<<book[temp].bookTitle<<setw(5)<<book[temp].wholesale<<endl;
		sum+=book[temp].wholesale*book[temp].qtyOnHand;
	}
	cout<<"   批发总额:  "<<sum<<endl;
}
void Report::lsshow()
{
	cout<<setw(11)<<"书名   "<<setw(5)<<"批发价 "<<endl;
	float sum=0;
	for(int temp=1;temp<=num;temp++)
	{
		
		cout<<setw(11)<<book[temp].bookTitle<<setw(5)<<book[temp].retail<<endl;
		sum+=book[temp].retail*book[temp].qtyOnHand;
	}
	cout<<"   零售总额:  "<<sum<<endl;
}

void Report::onhandshow()
{
	for(int i=1;i<100;i++)
	{
		book[i].showed=0;
	}
	cout<<setw(11)<<"书名   "<<setw(5)<<"库存量"<<endl;
	
	int n=num;
	int toshow;
	while(n>0)
	{
		int max=0;
		for(int temp=1;temp<=num;temp++)
		{  
			
			if(book[temp].qtyOnHand>max && book[temp].showed==0)
			{
				max=book[temp].qtyOnHand;
				toshow=temp;
			}
		}
		cout<<setw(11)<<book[toshow].bookTitle<<"  "<<setw(5)<<book[toshow].qtyOnHand<<endl;
		book[toshow].showed=1;
		n--;
	
	}
} 

void Report::priceshow()
{
	for(int i=1;i<100;i++)
	{
		book[i].showed=0;
	}
	cout<<setw(11)<<"书名   "<<setw(5)<<"库存量"<<"  "<<setw(5)<<"批发价"<<endl;
	
	int n=num;
	int toshow;
	while(n>0)
	{
		float maxvolue=0;
		for(int temp=1;temp<=num;temp++)
		{
			
			if(book[temp].qtyOnHand*book[temp].wholesale>maxvolue && book[temp].showed==0)
			{
				maxvolue=book[temp].qtyOnHand*book[temp].wholesale;
				toshow=temp;
			}
				cout<<setw(11)<<book[toshow].bookTitle<<"  "<<setw(5)<<book[toshow].qtyOnHand<<"  "<<setw(5)<<book[toshow].wholesale<<endl;
		book[toshow].showed=1;
		n--;
		}
		
	
	}
}
void Report::dateshow()
{
	for(int i=1;i<100;i++)
	{
		book[i].showed=0;
	}
	cout<<" 书名       入库日期  "<<endl;
	
	int n=num;
	int toshow;
	while(n>0)
	{
		char earlest[11]="9999999999";
		for(int temp=1;temp<=num;temp++)
		{
			
			if(strcmp(book[temp].dateAdded,earlest)<0&&book[temp].showed==0)
				
			{
				strcpy(earlest,book[temp].dateAdded);
				toshow=temp;
			}
			cout<<book[toshow].bookTitle<<"  "<<book[toshow].dateAdded<<endl;
			book[toshow].showed=1;
			n--;
		}		
	}
}

⌨️ 快捷键说明

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