홍용민

adding exit function

Showing 1 changed file with 6 additions and 2 deletions
1 #include<iostream> 1 #include<iostream>
2 +#include<string>
2 using namespace std; 3 using namespace std;
3 4
4 int main() { 5 int main() {
5 - char c; 6 + string c;
6 7
7 - cout << "Enter a character -> "; 8 + cout << "Enter string -> ";
8 cin >> c; 9 cin >> c;
9 10
11 + if (c == "exit") {
12 + return 0;
13 + }
10 cout << "you enter \"" << c << "\"" << endl; 14 cout << "you enter \"" << c << "\"" << endl;
11 15
12 return 0; 16 return 0;
......