//struct Material{ Quota{ struct Bill{是题目给出的结构体。
/*材料*/
struct Material{
string code;
string name;
string spec;
string vendor;
string unit;
double quantity;
double cost;
//这个是材料单价。。。取名这样。。。坑
double cost_sum;
};
/*定额*/
struct Quota{
string code;
string name;
string content;
string unit;
double quantity;
double cost;
double cost_sum;
std::list<Material* > materials;
};
/*清单*/
struct Bill{
string code;
string name;
string spec;
string content;
string unit;
double quantity;
double cost;
double cost_sum;
std::list<Quota* > quotas;
};
实现一种统计方法,汇总制定清单项目,std::list<Bill*>中各种材料的使用量,以及该材料被哪些额定所使用,并记录使用量
注:a.材料汇总时,编码.名称,规格型号,厂商,几辆单位,单价均相同时才被视为同一材料。
b.代码中加入有效注释
我只找了一个Bill,只是一个测试,没优化过,速度慢。
#include "stdafx.h"
#include <vector>
#include <string>
#include <iostream>
#include <list>
#include <time.h>
using namespace std;
int serial = 0;
//
struct Material{ Quota{ struct Bill{是题目给出的结构体。
/*材料*/
struct Material{
string code;
string name;
string spec;
string vendor;
string unit;
double quantity;
double cost;
double cost_sum;
};
/*定额*/
struct Quota{
string code;
string name;
string content;
string unit;
double quantity;
double cost;
double cost_sum;
std::list<Material* > materials;
};