int main(void) { FruitSeller seller; seller.InitMembers(1000, 20, 0); FruitBuyer buyer; buyer.InitMembers(5000); buyer.BuyApples(seller, 2000); cout<<"과일 판매자의 현황"<<endl; seller.ShowSalesResult(); cout<<"과일 구매자의 현황"<<endl; buyer.ShowBuyResult(); return 0; }
void buyApples(FruitSeller &seller, int money) { if (money < 0) { cout << "No Way...." << endl; return; } numOfApples += seller.saleApples(money); myMoney -= money; }
int main() { FruitSeller seller; seller.InitMembers(1000, 20, 0); FruitBuyer buyer; buyer.InitMembers(5000); buyer.buyApples(seller, 2000); cout << "Seller Result" << endl; seller.ShowSalesResult(); cout << "Buyer Result" << endl; buyer.ShowBuyResult(); FruitBuyer buyer2; FruitSeller seller2; buyer2.InitMembers(-100); seller2.InitMembers(-10, 200, 192); buyer.buyApples(seller, -200); return 0; }
void BuyApples(FruitSeller &seller, int money) { numOfApples += seller.SaleApples(money); myMoney -= money; }