Algorithm/C++ - 프로그래머스

프로그래머스 - 문자열을 정수로 바꾸기 C++

ㅇㅇ잉 2021. 2. 9. 16:15

stoi를 이용해서 문자열을 정수로 바꾸어주면 된다.

1
2
3
4
5
6
7
8
9
#include <string>
#include <vector>
 
using namespace std;
 
int solution(string s) {
    int answer = stoi(s);
    return answer;
}
cs