C++ Programming Ch.3 Exercise 3 Solution
Problem: μνμμ μ¬μ©νλ νλ‘κ·Έλ¨μ μμ±νκΈ° μν΄, μν κ³μ’ νλλ₯Ό νννλ ν΄λμ€ Accountκ° νμνλ€. κ³μ’ μ 보λ κ³μ’μ μ£ΌμΈ, κ³μ’ λ²νΈ, μμ‘μ λνλ΄λ 3 λ©€λ² λ³μλ‘ μ΄λ£¨μ΄μ§λ€. main() ν¨μμ μ€νκ³Ό κ²°κ³Όκ° λ€μκ³Ό κ°λλ‘ Account ν΄λμ€λ₯Ό μμ±νλΌ. 1 2 3 4 5 6 7 8 9 10 #include using namespace std; int main() { Account a("Kitae", 1, 5000); // id 1λ², μμ‘ 5000μ, μ΄λ¦μ΄ KitaeμΈ κ³μ’ μ± a.deposit(50000); // 50000μ μ κΈ cout << a.getOwner() << "μ μμ‘μ " << a.inquiry() << endl; int money = a.withdraw(20000); // 20000μ μΆκΈ. withdraw()λ μΆκΈν μ€μ κΈμ‘ λ¦¬ν΄ cout << a.getOwner() << "μ μμ‘μ " << a.inquiry() << endl; } Execution Result: ...