/*Test
1. 水容器
2. 3个方法
3. 连接容器,share容量并且平分
<Container*,set<Container*>>
*/
class Container {
public:
Coutainer(double amount){
amount_=amount;
}
void AddWater(double amount){
int average=amount/(nums.size());
for (int i=0;i<nums.size();i++){
nums[i].Add(average);
}
return;
}
void Add(double average) {
amount_+=average;
return;
}
void Adjust(double value) {
amount=value;
}
double GetAmount() {
return amount_;
}
void Connect(Container &other){
Container* temp=&other;
nums.push_back(temp);
double sumit=0;
for (int i=0;i<nums.size();i++) {
sumit=nums[i].GetAmount();
}
sumit=sumit/nums.size();
for (int i=0;i<nums.size();i++) {
nums[i].Adjust();
}
}
private:
double amount_;
vector<Container*>nums;
}