/*
#include <iostream>
using namespace std;
int main()
{
cout << "Hello world!" << endl;
return 0;
}
*/
/*
#include<iostream>
#include<string>
#include<map>
using namespace std;
int main()
{
map<string, string> dic;
cout << "***암호관리 프로그램 WHO를 시작합니다***" << endl;
int n;
while(true)
{
string name, pw;
cout << "삽입:1, 검사:2, 종료:3>>";
cin >> n;
if(n==1)
{
cout << "이름 암호>>";
cin >> name >> pw;
dic.insert(make_pair(name,pw));
}
else if(n==2)
{
cout << "이름?";
cin >> name;
if(dic.find(name)==dic.end())
{
cout<< "실패~~" << endl;
}
else
{
cout << "암호?";
cin >> pw;
if(dic[name] == pw)
{
cout << "통과!!" << endl;
}
else
{
cout << "실패~~" << endl;
}
}
}
}
else
{
cout << "프로그램을 종료합니다..." << endl;
break;
}
}
}
*/
/*
#include<iostream>
#include<string>
#include<map>
using namespace std;
int main()
{
map<string, string> dic;
cout << "***암호관리 프로그램 WHO를 시작합니다***" << endl;
int n;
while(true)
{
string name, pw;
cout << "삽입:1, 검사:2, 종료:3>>";
cin >> n;
if(n==1)
{
cout << "이름 암호>>";
cin >> name >> pw;
dic.insert(make_pair(name,pw));
}
else if(n==2)
{
while(true)
{
cout << "이름?";
cin >> name;
if(dic.find(name)==dic.end())
{
cout<< "실패~~" << endl;
}
else
{
while(true)
{
cout << "암호?";
cin >> pw;
if(dic[name] == pw)
{
cout << "통과!!" << endl;
break;
}
else
{
cout << "실패~~" << endl;
}
}
break;
}
}
}
else
{
cout << "프로그램을 종료합니다..." << endl;
break;
}
}
}
*/
#include<iostream>
#include<vector>
#include<string>
using namespace std;
class Circle{
string name;
int radius;
public:
Circle(int radius, string name)
{
this->radius = radius;
this->name = name;
}
double getArea()
{
return 3.14*radius*radius;
}
string getName()
{
return name;
}
};
int main()
{
vector<Circle> v;
vector<Circle>::iterator it;
cout << "원을 삽입하고 삭제하는 프로그램입니다." << endl;
while(true)
{
string circle;
int r,n;
cout << "삽입:1, 삭제:2, 모두보기:3, 종료:4 >>";
cin >> n;
if(n==1)
{
cout << "생성하고자 하는 원의 반지름과 이름은 >>";
cin >> r >> circle;
Circle x(r,circle);
v.push_back(x);
}
else if(n==2)
{
cout << "삭제하고자 하는 원의 이름은 >>";
cin >> circle;
for(it=v.begin();it!=v.end(); )
{
//cout << "*" << it->getName() << endl;
if(circle==it->getName())
{
cout << "*" << it->getName() << endl;
it = v.erase(it);
if(it==v.end()) {
break;
}
}
else{
it++;
}
}
}
else if(n==3)
{
for(it=v.begin();it!=v.end();it++)
{
cout << it->getName() << endl;
}
}
else
{
cout << "프로그램을 종료합니다..." << endl;
break;
}
}
}