/**********************/
//图书管理系统V1.0
//作者: ntdom
//E-mail:ntdom@163.com
/**********************/
/*文件cr.h*/
class cr
{
public:
void setcr(int cbh,int cjg,int cn);
int c[3];
};
void cr::setcr(int cbh,int cjg,int cn)
{
c[0]=cbh;
c[1]=cjg;
c[2]=cn;
}
/*文件yf.h*/
class yf
{
public:
void setyf(int fbh,int fn);
int f[2];
};
void yf::setyf(int fbh,int fn)
{
f[0]=fbh;
f[1]=fn;
}
/*文件main*/
#include "iostream.h"
#include "stdio.h"
#include "cr.h"
#include "yf.h"
void bijiao(int,int);
void p(void);
void ccr();
void yyf();
char m();
int z;
char key;
int k=0;
int cshuhao,cdanjia,cshumu;
int fshuhao,fshumu;
cr i[1000];
yf j;
void main()
{
m();
}
void bijiao(int i,int j)
{
if (i==j) p();
else {cout<<"error!"<<endl;}
}
void p()
{ if (i[z].c[2]>=j.f[1]){
cout<<"yingfu:";
cout<<i[z].c[1]*j.f[1]<<endl;
i[z].c[2]-=j.f[1];}
else cout<<"error"<<endl;
}
void ccr()
{
cout<<"Input shuhao!"<<endl;
cin>>cshuhao;
cout<<"Input danjia!"<<endl;
cin>>cdanjia;
cout<<"Input shumu!"<<endl;
cin>>cshumu;
i[k].setcr(cshuhao,cdanjia,cshumu);
}
void yyf()
{
cout<<"Input shuhao!"<<endl;
cin>>fshuhao;
cout<<"Input shumu!"<<endl;
cin>>fshumu;
j.setyf(fshuhao,fshumu);
for (z=0;z<k;z++)
bijiao(j.f[0],i[z].c[0]);
}
char m()
{
cout<<"ruku or maichu?"<<endl;
cout<<"Input r or m!"<<endl;
cin>>key;
if (key=='r') { ccr(); k++;return (m());}
else if(key=='m') {yyf();return (m());}
else {cout<<"error"<<endl;return 0;}
}