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: ...