* Mall goods discounts. Consumption is 10% higher than 400 yuan, and 800 yuan is 20% off. More than 1,000 yuan to play 7.5 fold. The consumption amount can be accumulated separately. If the "consumption" is defined as a class, then each consumption can be defined as an object. However, because of the discount, the accumulation results of the two consumption amount are not simple, such as the first consumption of 300 yuan. After the second consumption of 200 yuan, the total amount should be (300 200) * 0.9 = 450 yuan. Please write the "consumption" definition and overload the " " operator for the class to achieve multiple consumption, with " " to accumulate consumption amount and output the accumulated consumption amount. "Consumption" that is required to use a mark will no longer participate in discounts. * /
#include
Consime :: 40.0; discountsum = 0.0; discountsum = 0.0; disrt = 0.0;} consume :: consume (float money) {SUM = MONEY; IF (Money <400) discountsum = Money; Else IF (Money <800) Discountsum = Money * 0.9; Else IF (Money <1000) discountsum = Money * 0.8; Else IF (Money> = 1000) discountsum = Money * 0.75; DIS = SUM-Discountsum;} consume :: ~ consume () {} void Consime :: Operator = (Consume & Another) {SUM = Another.Sum; INT DS = discountsum; DS = another.sum; // Real consumption this amount (actual item price) IF (DS <400) discountsum = another. SUM; Else IF (DS <800) discountsum = another.sum * 0.9; Else IF (DS <1000) discountsum = another.sum * 0.8; else discountsum = another.sum * 0.75; disx= sum-discountsum;} void Consume :: DisplayStatus () {cout << "The amount of consumption you cope before you have not discount:" << Sum << Endl; cout << "After the discount, your actual consumption amount is:" << discountsum << endl; COUT << "The total discount amount is:" << disc