C++ 命令行窗口输入

C++ 命令行窗口输入

参考leetcode的playground https://leetcode.cn/playground/new/empty/

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
class Solution {
public:
int add(int a, int b) {

}
};

int stringToInteger(string input) {
return stoi(input);
}

int main() {
string line;
while (getline(cin, line)) {
int a = stringToInteger(line);
getline(cin, line);
int b = stringToInteger(line);

int ret = Solution().add(a, b);

string out = to_string(ret);
cout << out << endl;
}
return 0;
}