정대욱

exit

Showing 1 changed file with 4 additions and 0 deletions
1 #include <iostream> 1 #include <iostream>
2 +#include <cstring>
2 3
3 int main() { 4 int main() {
4 char buffer[256]; 5 char buffer[256];
5 6
6 std::cout << "Hello! Please enter some text:\n>> "; 7 std::cout << "Hello! Please enter some text:\n>> ";
7 while (std::cin >> buffer) { 8 while (std::cin >> buffer) {
9 + if (strcmp(buffer, "exit") == 0)
10 + break;
11 +
8 std::cout << buffer << std::endl; 12 std::cout << buffer << std::endl;
9 std::cout << ">> "; 13 std::cout << ">> ";
10 } 14 }
......