本代码主要实现了在期望天数下的猪的查询及价格计算,下面写主要框架:
struct Cpig{
int species;//种类 1黑 2小花 3大花白
int growday;
double weight;//重量
int number;//编号
Cpig *next;
};//猪
class Pigsty{
private:
int cnt;
Cpig *head;
int s;//判别 无黑猪0,有黑猪1
public:
Pigsty(){
cnt=0;
head=NULL;
int s=0;
};
int sets(int i);
int getcnt();
int getspecies(int i);
int getspecies1();
int getspecies2();
int getspecies3();
double getweight(int num);
int getgrowday(int num);
double getprice();
void addpig(Cpig *p);
void next();
void sold();
};//猪圈