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