From f3626729df333592117a41bed2abc0fc302779cf Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 21 Nov 2024 07:35:19 +0000 Subject: [PATCH] =?UTF-8?q?=EC=9D=B4=EC=8A=88=20#371=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EC=86=94=EB=A3=A8=EC=85=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4\354\202\260\355\225\230\352\270\260.cpp" | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 "Programmers/\353\254\270\354\236\220\354\227\264_\352\263\204\354\202\260\355\225\230\352\270\260.cpp" diff --git "a/Programmers/\353\254\270\354\236\220\354\227\264_\352\263\204\354\202\260\355\225\230\352\270\260.cpp" "b/Programmers/\353\254\270\354\236\220\354\227\264_\352\263\204\354\202\260\355\225\230\352\270\260.cpp" new file mode 100644 index 0000000..f045a47 --- /dev/null +++ "b/Programmers/\353\254\270\354\236\220\354\227\264_\352\263\204\354\202\260\355\225\230\352\270\260.cpp" @@ -0,0 +1,21 @@ +#include +#include +#include + +using namespace std; + +int solution(string my_string) { + stringstream ss(my_string); + int result; + ss >> result; + + char op; + int number; + + while(ss >> op >> number) { + if(op == '+') result += number; + else if(op == '-') result -= number; + } + + return result; +} \ No newline at end of file