Skip to content

Commit b124956

Browse files
committed
exit built in
1 parent 61bd9af commit b124956

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/main.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ int main() {
1010
do {
1111
std::cout << "$ ";
1212
std::getline(std::cin, input);
13+
std::string cmd = input.substr(0, input.find(' '));
14+
std::string args = input.substr(input.find(' ') + 1);
15+
if (cmd == "exit") {
16+
exit(std::stoi(args));
17+
}
1318
if (input != "") {
1419
std::cout << input << ": command not found" << std::endl;
1520
}

0 commit comments

Comments
 (0)