๐Ÿ’ป Dev & CSC++ Programming

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

March 4, 2020 ยท 1 min ยท Sobamemil