Advertisement
Touch_Grass

Untitled

Apr 29th, 2023
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | Source Code | 0 0
  1.     for (int i = 0; i < ansNums.size(); i++) {
  2.         if (i <= operators.size()) {
  3.             if (operators[i] == "+") {
  4.                 out += ansNums[i];
  5.             } else if (operators[i] == "-") {
  6.                 out -= ansNums[i];
  7.             }
  8.         } else {
  9.             if (operators[i-1] == "+") {
  10.                 out += ansNums[i];
  11.             } else if (operators[i-1] == "-") {
  12.                 out -= ansNums[i];
  13.             }
  14.         }
  15.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement