C++ Programming Ch.4 Exercise 6 Solution
Problem: string ํด๋์ค๋ฅผ ์ด์ฉํ์ฌ ์ฌ์ฉ์๊ฐ ์ ๋ ฅํ ์๋ฌธ ํ ์ค์ ๋ฌธ์์ด๋ก ์ ๋ ฅ๋ฐ๊ณ ๊ฑฐ๊พธ๋ก ์ถ๋ ฅํ๋ ํ๋ก๊ทธ๋จ์ ์์ฑํ๋ผ. Objective & Hints: string ํด๋์ค๋ก ๋ฌธ์์ด ๋ค๋ฃจ๊ธฐ Execution Result: Code: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 #include #include using namespace std; int main() { string str; cout << "์๋ ํ ์ค์ ์ ๋ ฅํ์ธ์.(exit๋ฅผ ์ ๋ ฅํ๋ฉด ์ข ๋ฃํฉ๋๋ค)"; while(true){ cout << endl << ">>"; getline(cin,str); if(str == "exit") break; for(int i = str.length()-1; i>=0; i--) cout << str[i]; } } Explanation: ...