Skip to content
This repository was archived by the owner on Jul 29, 2025. It is now read-only.

Commit 30dfec5

Browse files
committed
Step 5 - Green
1 parent 8ec9971 commit 30dfec5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

add.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ int add(string numbers) {
1010
delimeter = numbers[2];
1111
numbers = numbers.substr(4);
1212
}
13+
if (numbers.find("-") != string::npos) {
14+
throw runtime_error("negatives not allowed: -" + numbers.substr(numbers.find("-") + 1, 1));
15+
}
1316
int sum = 0;
1417
stringstream ss(numbers);
1518
string num, strg;

0 commit comments

Comments
 (0)