1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream>
#include <string>
using namespace std;
 
int main() {
    string line;
    cout << "아래에 한 줄을 입력하세요.(exit를 입력하면 종료합니다)" << endl;
    while (1) {
        cout << ">>";
        getline(cin, line);
        if (line == "exit") {
            break;
        }
        int size = line.length();
        int h_size = line.length() / 2;
        for (int i = 0; i < h_size; i++) {
            char tmp = line[size - 1 - i];
            line[size - 1 - i] = line[i];
            line[i] = tmp;
        }
        cout << line << endl;
    }
}
cs

+ Recent posts