ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • C++ 전화번호부 만들기
    C++ 2017. 11. 17. 01:41
    반응형

    //#include <iostream> //완성 -- 아예 입력받을때 힙메모리로 입력을 받으면 나중에 편할것같다.

    //#include <cstring> // 삭제할때 편리해진다. 복사할 필요없이 바로 가능

    //#include <conio.h>

    //

    //using namespace std;

    //char Menu()

    //{

    // cout<<"1. 전화번호 등록"<<endl;

    // cout<<"2. 전화번호 출력"<<endl;

    // cout<<"3. 전화번호 검색"<<endl;

    // cout<<"4. 전화번호 삭제"<<endl;

    // cout<<"0. 프로그램 종료"<<endl;

    // return getch();

    //}

    //

    //

    //class PhNum

    //{

    //private:

    // char* name;

    // char* num;

    //public:

    // void Input(char* bufname=0, char* bufnum=0)

    // {

    // name = bufname;

    // num = bufnum;

    // }

    // char* Getname()

    // {

    // return name;

    // }

    // char* Getnum()

    // {

    // return num;

    // }

    //};

    //

    //class NumBook

    //{

    //private:

    // PhNum index[100];

    // int count;

    //public:

    // NumBook()

    // {

    // count=0;

    // }

    // void WritePhNum()

    // {

    // if(count==0)

    // {

    // cout<<"이름을 입력하시고 띄어쓰기후 번호를 입력하세요"<<endl;

    // cout<<"예 ; 홍길동 010-1234-5678"<<endl;

    // }

    // char _bufname[100];

    // char _bufnum[100];

    // cout<<"이름 / 번호 입력 : ";

    // char* bufname = new char[strlen(_bufname)+1];

    // char* bufnum = new char[strlen(_bufnum)+1];

    // cin>>bufname>>bufnum;

    // index[count++].Input(bufname,bufnum);

    // }

    // void PrintPhNum()

    // {

    // int i;

    // for(i=0 ; i<count ; ++i)

    // cout<<index[i].Getname()<<" : "<<index[i].Getnum()<<endl;

    // }

    // void Search()

    // {

    // cout<<"1.번호 검색"<<endl<<"2.이름검색"<<endl;

    // switch(getch())

    // {

    // case '1':

    // char searchnum[100];

    // cout<<"검색할 번호를 입력하세요 : ";

    // cin>>searchnum;

    // for(int i=0 ; i<count ; ++i)

    // if( strcmp(index[i].Getnum(),searchnum) == 0)

    // cout<<index[i].Getname()<<" : "<<index[i].Getnum()<<endl;

    // break;

    // case '2':

    // char searchname[100];

    // cout<<"검색할 이름을 입력하세요 : ";

    // cin>>searchname;

    // for(int i=0 ; i<count ; ++i)

    // if( strcmp(index[i].Getname(),searchname) == 0)

    // cout<<index[i].Getname()<<" : "<<index[i].Getnum()<<endl;

    // break;

    // }

    // }

    // void Delete()

    // {

    // int i;

    // char search[100];

    // cout<<"삭제할 이름을 입력하세요 : ";

    // cin>>search;

    // for(i=0 ; i<count ; ++i)

    // if( strcmp(index[i].Getname(),search) == 0)

    // {

    // delete[] index[i].Getname();

    // delete[] index[i].Getnum();

    // index[i].Input(index[i+1].Getname() ,index[i+1].Getnum());

    // count--;

    // }

    // }

    // void Deletehip()

    // {

    // for(int i = 0; i<count ; ++i)

    // {

    // delete[] index[i].Getname();

    // delete[] index[i].Getnum();

    // }

    // }

    //};

    //

    //void main()

    //{

    // NumBook main;

    // bool run = true;

    // while(run)

    // {

    // switch(Menu())

    // {

    // case '1':

    // main.WritePhNum();

    // break;

    // case '2':

    // main.PrintPhNum();

    // break;

    // case '3':

    // main.Search();

    // break;

    // case '4':

    // main.Delete();

    // break;

    // case '0':

    // run = false; 

    // break;

    // }

    // }

    // main.Deletehip();

    //}

    반응형

    'C++' 카테고리의 다른 글

    C++ 공튀기기  (0) 2018.07.05
    C++ 미니 방탈출  (0) 2018.07.04

    댓글

Designed by Tistory.