C++ Programming Ch.7 Exercise 11 Solution
Problem: ์คํ ํด๋์ค Stack์ ๋ง๋ค๊ณ ํธ์(push)์ฉ์ผ๋ก << ์ฐ์ฐ์๋ฅผ, ํ(pop)์ ์ํด >> ์ฐ์ฐ์๋ฅผ, ๋น์ด ์๋ ์คํ์ธ์ง๋ฅผ ์๊ธฐ ์ํด ! ์ฐ์ฐ์๋ฅผ ์์ฑํ๋ผ. ๋ค์ ์ฝ๋๋ฅผ main()์ผ๋ก ์์ฑํ๋ผ. 1 2 3 4 5 6 7 8 9 Stack stack; stack << 3 << 5 << 10; // 3,5,10 ์์๋๋ก push while(true){ if(!stack) break; //stack empty int x; stack >> x; //stack์ top์ ์๋ ์ ์ pop cout << x << ' '; } cout << endl; Execution Result: ...