?? report.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 + -