Skip to content

Commit 61bd9af

Browse files
committed
refactoring
1 parent ee3cd18 commit 61bd9af

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

src/main.cpp

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@
22
#include <string>
33

44
int main() {
5-
// Flush after every std::cout / std:cerr
6-
std::cout << std::unitbuf;
7-
std::cerr << std::unitbuf;
5+
// Flush after every std::cout / std:cerr
6+
std::cout << std::unitbuf;
7+
std::cerr << std::unitbuf;
88

9-
std::string input;
10-
while(true) {
11-
std::cout << "$ ";
12-
std::getline(std::cin, input);
13-
if (input == "") {
14-
break;
15-
}
16-
std::cout << input << ": command not found" << std::endl;
17-
}
18-
}
9+
std::string input;
10+
do {
11+
std::cout << "$ ";
12+
std::getline(std::cin, input);
13+
if (input != "") {
14+
std::cout << input << ": command not found" << std::endl;
15+
}
16+
} while(input != "");
17+
}

0 commit comments

Comments
 (0)