#include <iostream>
#include <list>
#include <vector>
#include <string>
#include <conio.h>

using namespace std;

typedef struct _list
{
 int    idx;
 string name;
 string telnum;
} List;


void Insert( vector<list<List> > & rhs )
{
 List tmp;
 int tn;

 cout << "고객번호 입력" << endl;
 cin >> tn;
 if(cin.fail())
 {
  cout << "잘못된 입력";
  cout << "차트0번에 입력 됩니다." << endl;
  cin.clear();
  while(!isspace(cin.get()))
   continue;
 }
 
 tmp.idx = tn%10;
 cout << "이름 입력" << endl;
 cin >> tmp.name;
 cout << "전화번호 입력" << endl;
 cin >> tmp.telnum;
 
 rhs[tmp.idx].push_back(tmp);
 cout << "press any key to continue" ;
 getche();
 system("cls");
}

void Print( vector<list<List> > tmp )
{
 for(int i=0; i<10; i++)
 {
  cout << "[" << i << "]번차트" << endl;
  list<List>::iterator ptr = tmp[i].begin();
  while( ptr != tmp[i].end() ) {
   cout << ptr->name << "\t\t";
   cout << ptr->telnum << endl;
   ptr++;
  } 
 }
 cout << "press any key to continue" ;
 getche();
 system("cls");
}

list<List>::iterator Serch( vector<list<List> > tmp )
{
 string s_vel;
 cout << "찾으실 이름을 입력하세요" << endl;
 cin >> s_vel;
 
 for(int i=0; i<10; i++)
 {
  list<List>::iterator ptr = tmp[i].begin();
  while( ptr != tmp[i].end() ) {
   if( ptr->name == s_vel ){
    cout << ptr->name << endl;
    cout << ptr->telnum << endl;
    return ptr;
   }
   ptr++;
  }
 }
 return 0;
}

void Delete( vector<list<List> > tmp )
{
 string s_vel;
 cout << "찾으실 이름을 입력하세요" << endl;
 cin >> s_vel;
 
 for(int i=0; i<10; i++)
 {
  list<List>::iterator ptr = tmp[i].begin();
  while( ptr != tmp[i].end() ) {
   if( ptr->name == s_vel ){
   
   }
   ptr++;
  }
 }
}

void main()
{
 vector<list<List> >  tmp(10);
 char ch;
 
 while (1) {
  cout << "1. 입 력" << endl;
  cout << "2. 출 력" << endl;
  cout << "3. 검 색" << endl;
  cout << "4. 삭 제" << endl;
  cout << "5. 종 료" << endl;
  cout << "메뉴선택[ ]\b\b"; cin >> ch;
  system("cls");
  switch(ch) {
  case '1': Insert( tmp ); break;
  case '2': Print( tmp );  break;
  case '3': Serch( tmp );  break;
  case '4': Delete( tmp ); break;
  case '5': exit(0);
  default : cout << "다시 입력하세요" << endl;
  }
 }
}

Posted by 나비:D
:
BLOG main image
by 나비:D

공지사항

카테고리

분류 전체보기 (278)
Programming? (0)
---------------------------.. (0)
나비의삽질 (5)
Application (177)
SQL (51)
Web (27)
etc. (14)
Omnia (0)
---------------------------.. (0)

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

글 보관함

달력

«   2024/12   »
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
Total :
Today : Yesterday :