-
Notifications
You must be signed in to change notification settings - Fork 0
/
ch10 14번문제.cpp
49 lines (42 loc) · 1.18 KB
/
ch10 14번문제.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <iostream>
#include <map>
using namespace std;
int main()
{
map<string, string>dic;
string name, password;
int index;
cout << "암호 관리 프로그램 WHO를 시작합니다 " << endl;
while(true)
{
cout << "삽입:1, 검사:2, 종료:3>> ";
cin >> index;
switch (index) {
case 1:
cout << "이름 암호 >> ";
cin >> name >> password;
dic.insert(make_pair(name, password));
break;
case 2:
cout << "이름? ";
cin >> name;
while(true)
{
cout << "암호? ";
cin >> password;
if(dic[name] == password){
cout << "통과!! " << endl;
break;
}
else
cout << "실패!! " << endl;
}
break;
}
if(index == 3)
{
cout << "프로그램을 종료합니다... " << endl;
break;
}
}
}