?? supmakt.h
字號(hào):
// Contain Goods's kind, name, price, number, conserve_date
// Goods.cpp - for goods's information
#include <iostream>
using namespace std;
#ifndef GOODS_H_
#define GOODS_H_
// base class
class Goods_Info{
private:
enum {KIND = 20};
enum {NAME = 35};
int kind;
char name[NAME];
double price;
double inprice;
int number;
int total_number;
char conserve_date[11];
int has_it;
double total_price;
double in_total_price;
double profit;
double profited;
public:
const int Kind() const{ return kind;}
const char * Name() const { return name;}
const double Price() const { return price;}
const int Number() const { return number;}
const char * ConseveDate() const { return conserve_date;}
const int Hasit() const { return has_it;}
const double Inprice() const { return inprice;}
const int Total_number() const { return total_number;}
const double Total_price() const { return total_price;}
const double In_total_price() const { return in_total_price;}
const double Profit() const { return profit;}
const double Profited_return() const { return profited;}
Goods_Info(const int kd = 100001,
const char * nm = "none name",
double pri = 0.0,
int num = 0,
const char * con_date = "20080525",
int ht = 0,
double inpri = 0.0,
double total_pri = 0.0,
double in_total_pri = 0.0,
double profi =0.0,
double profied = 0.0);
int num_add(){ return ++ kind ;}
int number_add( int m ){
if (-m > number) {
cerr << "You sell more goods! ERROR!" << endl;
return 0;
}
number += m;
return 1;
}
int price_add(double pri){
price += pri;
return 1;
}
void updName(char * nm){
strncpy(name, nm, NAME - 1);
name[NAME - 1] = '\0';
}
void updPrice(double pri){
price = pri;
}
void updAmount(int amn){
number = amn;
}
void updConserve(char * con_date){
strncpy(conserve_date, con_date, 10);
}
int hasit_upd(){
if (number <= 0) {
has_it = 0;
}else{
has_it = 1;
}
return 1;
}
int Has_It() const { return has_it;}
virtual ~Goods_Info(){
cout << "Goods_Info's deconstructor executed !"<< endl;
}
int Show(){
cout << kind << "\t" << name << "\t" << number << "\t" << inprice <<"\t" << price
<< "\t" << conserve_date << "\t" << has_it ;
return 1;
}
// Compute total_price
void TotalPrice(int temp){ total_price += temp * price; }
// Compute profit
void TotalProfit(int temp){ profit += (price - inprice) * temp; }
void Profited(int sell_num){ profited += (price - inprice) * sell_num;
//profited = abs(profited);
}
// Compute total_number
void TotalNumber(int temp){ total_number += temp; }
// Compute in_total_price
void Cin_total_price(){
in_total_price = number * inprice;
}
};
// Foodstuff class
class Foodstuff:public Goods_Info{
private:
enum {SMELL = 20};
char smell[SMELL];
public:
const char * Smell() const { return smell;}
Foodstuff(const int kd = 100001,
const char * nm = "none name",
double pri = 0.0,
int num = 0,
const char * con_date = "20080101",
int ht = 0,
double inpri =0.0,
int total_num = 0,
double total_pri = 0.0,
double in_total_pri = 0.0,
double profi =0.0,
double profied = 0.0,
const char * sm = "none");
int FoodstuffShow(){
Show();
cout << "\t" << smell << endl;
return 1;
}
void sell(int num = 0){
if ( num < num ) {
cerr << " This goods's amount is lacking ! " << endl;
}else{
num -= num;
}
}
};
// Define link
typedef struct anode{
Foodstuff *data;
struct anode *next;
}node;
// Function declare
void dh();
void pria();
void priz();
int pri_load();
int pri();
int sest();
int priquery();
int pridel();
void clear();
node *init();
node *addRec(node * header);
node * searchSmall(node * header);
node *search(node *header,int n);
void deleteKind(node * header, int kind);
void SortLink(node * head);
void display(node *header);
void freeMemory(node *header);
int link_size( node *header );
void del_all(node *header);
node *data_load();
void data_save(node *header);
int Sell(node * header);
void Stock(node * header);
int AccountShow(node * head);
int DataMaintenance(node * header);
#endif
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -