티스토리 뷰

LANGUAGE/C++

[C++] 급여관리 프로그램

진심스테이크 2018. 3. 12. 09:32

 

클래스 관계도를 이용해서 급여 관리 프로그램 만들어보기

 

상위 데이터 클래스

#include "stdafx.h"
#include <Windows.h>
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;

class Info { //Info에 대한 정보를 넣는 data 클래스
    string info;
public:
    void setInfo(string info) { this->info = info; }
    string getInfo() { return info; }
};

class Money { //Money에 대한 정보를 넣는 data 클래스
    float money;
public:
    void setMoney(float money) { this->money = money; }
    float getMoney() { return money; }
};

class Time { //Time에 대한 정보를 넣는 data 클래스
    float time;
public:
    void setTime(float time) { this->time = time; }
    float getTime() { return time; }
};

 

데이터 클래스를 Has ~a 관계로 상속 받는 클래스

class Person { //Has-a관계로 Info, Money, Time의 클래스를 상속받는 클래스
               //Info
    Info name; //이름
    Info id; //사원번호
    Info phone; //전화번호
    Info account; //계좌
    Info bank; //은행
    Info address; //주소
    Info socialId; //주민등록번호호
    Info depart; //부서
    Info position; //직급

                   //Money
    Money monthPay; //월급
    Money found; //기본수당
    Money extend; //연장수당
    Money tax; //세금
    Money insur; //보험금
    Money totalPay; //총 급여
    Money bonus; //보너스

                 //Time
    Time hour; //시간
    Time day; //출근일수
    Time pvac; //유급휴가

public:
    //Info 
    void setName(string info) { name.setInfo(info); }
    string getName() { return name.getInfo(); }

    void setId(string info) { id.setInfo(info); }
    string getId() { return id.getInfo(); }

    void setPhone(string info) { phone.setInfo(info); }
    string getPhone() { return phone.getInfo(); }

    void setAccount(string info) { account.setInfo(info); }
    string getAccount() { return account.getInfo(); }

    void setBank(string info) { bank.setInfo(info); }
    string getBank() { return bank.getInfo(); }

    void setAddress(string info) { address.setInfo(info); }
    string getAddress() { return address.getInfo(); }

    void setSocialId(string info) { socialId.setInfo(info); }
    string getSocialId() { return socialId.getInfo(); }

    void setDepart(string info) { depart.setInfo(info); }
    string getDepart() { return depart.getInfo(); }

    void setPosition(string info) { position.setInfo(info); }
    string getPosition() { return position.getInfo(); }

    //Money
    void setMonthPay(float money) { monthPay.setMoney(money); }
    float getMonthPay() { return found.getMoney() * hour.getTime(); }
    //출근일수 * 시간 * 기본수당

    void setFound(float money) { found.setMoney(money); }
    float getFound() { return found.getMoney(); }

    void setExtend(float money) { extend.setMoney(money); }
    float getExtend() { return extend.getMoney(); }

    void setInsur(float money) { insur.setMoney(money); }
    float getInsur() { return insur.getMoney(); }

    void setTotalPay(float money) { totalPay.setMoney(money); }
    float getTotalPay() { return monthPay.getMoney() + extend.getMoney() + bonus.getMoney(); }
    //월급 + 연장수당
    void setBonus(float money) { bonus.setMoney(money); }
    float getBonus() { return bonus.getMoney(); }
    //Tax
    void setTax(float money) { tax.setMoney(money); }
    float getTax() { return getMonthPay() * 0.015; }

    //Time
    void setHour(float time) { hour.setTime(time); }
    float getHour() { return hour.getTime(); }

    void setDay(float time) { day.setTime(time); }
    float getDay() { return day.getTime(); }

    void setPvac(float time) { pvac.setTime(time); }
    float getPvac() { return pvac.getTime(); }
};

 

 

Person 클래스를 Is ~a 관계로 상속받는 정규직 / 계약직 클래스

class IrrManager : public Person { //Is-a관계로 Person의 클래스를 상속 받는 클래스 
                                   //계약직(알바 포함)
    float dayPay; //일급
public:
    void setDayPay(float dayPay) { this->dayPay = dayPay; }
    float getDayPay() { return dayPay; }
};

class FullManager : public Person { //Is-a관계로 Person의 클래스를 상속 받는 클래스
                                    //정규직
    float full; //만근수당
public:
    void setFull(float full) { this->full = full; }
    float getFull() { return full; }
};

 

 

정규직 / 비정규직 클래스를 Has ~a 관계로 상속받는 클래스

//오류 수정이 필요함 - 예외처리

class Master { //Has-a관계로 IrrManager 클래스와 FullManager 클래스를 상속 받는 클래스 
               //입력, 출력, 검색, 수정, 삭제
    IrrManager *im; //IrrManager에 대해 동적 할당
    FullManager *fm; //FullManager에 대해 동적 할당
public:
    //다음 배열로 넘어가기 위해 지정
    int countIr; //IrrManager
    int countFr; //FullManager

    Master() {
        im = new IrrManager[100]; //IrrManager의 크기가 100인 배열 - 한칸당 한명이 들어있음
        fm = new FullManager[100]; //FullManager의 크기가 100인 배열 - 한칸당 한명이 들어있음
        countIr = 0; //초기화
        countFr = 0; //초기화
    }

    int getCountIr() { return countIr; }
    int getCountFr() { return countFr; }

    int ImSearch() { //비정규직 검색 함수
        string idSearch; //사원번호 검색을 위한 변수(클래스) 지정
        cout << "사원 번호 검색 : ";
        cin >> idSearch;
        int i;
        for (i = 0; i < countIr; i++) { //현재 총 배열의 갯수(countIr) 만큼 반복 
            if (!idSearch.compare(im[i].getId())) { //입력한 사원번호가 나올때 까지 검색
                im[i].getId(); //검색한 사원번호가 있는 위치
                break;
            }
        }
        return i; //위치 반환
    }

    int FmSearch() { //정규직 검색 함수
        string idSearch;
        cout << "사원 번호 검색 : ";
        cin >> idSearch;
        int i;
        for (i = 0; i < countFr; i++) { //현재 총 배열의 갯수(countFr) 만큼 반복
            if (!idSearch.compare(fm[i].getId())) { //입력한 사원번호가 나올때 까지 검색
                fm[i].getId(); //검색한 사원번호가 있는 위치
                break;
            }
        }
        return i; //위치 반환
    }

    void ImFix(int p) { //비정규직 수정 함수
                        //위치를 p에 받음
        cout << "수정할 내용 입력 : ";
        string ch;
        string imfix;
        cin >> ch;
        //수정하고 싶은 내용만 수정하게끔
        if (ch == "이름") {
            cout << "이름 입력 : ";
            cin >> imfix;
            im[p].setName(imfix);
            cout << "수정 완료" << endl;
        }
        else if (ch == "주민등록번호") {
            cout << "주민등록번호 입력 : ";
            cin >> imfix;
            im[p].setSocialId(imfix);
            cout << "수정 완료" << endl;
        }
        else if (ch == "전화번호") {
            cout << "전화번호 입력 : ";
            cin >> imfix;
            im[p].setPhone(imfix);
            cout << "수정 완료" << endl;
        }
        else if (ch == "계좌번호") {
            cout << "계좌 입력 : ";
            cin >> imfix;
            im[p].setAccount(imfix);
            cout << "수정 완료" << endl;
        }
        else if (ch == "은행") {
            cout << "은행 입력 : ";
            cin >> imfix;
            im[p].setBank(imfix);
            cout << "수정 완료" << endl;
        }
        else if (ch == "주소") {
            cout << "주소 입력 : ";
            cin >> imfix;
            im[p].setAddress(imfix);
            cout << "수정 완료" << endl;
        }
        //else if (ch == "주민등록번호") {
        //   cout << "주민등록번호 입력 : ";
        //   cin >> imfix;
        //   im[p].setSocialId(imfix);
        //   cout << "수정 완료" << endl;
        //}
        else if (ch == "부서") {
            cout << "부서 입력 : ";
            cin >> imfix;
            im[p].setDepart(imfix);
            cout << "수정 완료" << endl;
        }
    }

    void FmFix(int p) { //정규직 수정 함수
                        //위치를 p에 받음
        cout << "수정할 내용 입력 : " << endl;
        string ch;
        cin >> ch;
        string fmfix;
        //수정하고 싶은 내용만 수정하게끔
        if (ch == "이름") {
            cout << "이름 입력 : ";
            cin >> fmfix;
            fm[p].setName(fmfix);
            cout << "수정 완료" << endl;
        }
        else if (ch == "주민등록번호") {
            cout << "주민등록번호 입력 : ";
            cin >> fmfix;
            fm[p].setSocialId(fmfix);
            cout << "수정 완료" << endl;
        }
        else if (ch == "전화번호") {
            cout << "전화번호 입력 : ";
            cin >> fmfix;
            fm[p].setPhone(fmfix);
            cout << "수정 완료" << endl;
        }
        else if (ch == "계좌번호") {
            cout << "계좌 입력 : ";
            cin >> fmfix;
            fm[p].setAccount(fmfix);
            cout << "수정 완료" << endl;
        }
        else if (ch == "은행") {
            cout << "은행 입력 : ";
            cin >> fmfix;
            fm[p].setBank(fmfix);
            cout << "수정 완료" << endl;
        }
        else if (ch == "주소") {
            cout << "주소 입력 : ";
            cin >> fmfix;
            fm[p].setAddress(fmfix);
            cout << "수정 완료" << endl;
        }
        /*else if (ch == "주민등록번호호") {
        cout << "주민등록번호호 입력 : ";
        cin >> fmfix;
        fm[p].setSocialId(fmfix);
        cout << "수정 완료" << endl;
        }*/
        else if (ch == "부서") {
            cout << "부서 입력 : ";
            cin >> fmfix;
            fm[p].setDepart(fmfix);
            cout << "수정 완료" << endl;
        }
        else if (ch == "직급") {
            cout << "직급 입력 : ";
            cin >> fmfix;
            fm[p].setSocialId(fmfix);
            cout << "수정 완료" << endl;
        }
    }

    void ImDelete() { //비정규직 삭제 함수
        string idSearch;
        cout << "삭제 할 사원 번호 : ";
        cin >> idSearch;
        for (int i = 0; i < countIr; i++) { //현재 총 배열의 갯수(countFr) 만큼 반복
            if (!idSearch.compare(im[i].getId())) { //입력한 사원번호가 나올때 까지 검색
                                                    //im[i].getId();
                countIr--; //총 배열의 갯수가 하나 줄어드는것을 알기 위해 지정
                cout << "삭제 완료" << endl;
                for (i; i < countIr; i++) {//비교해서 같으면 0을 반환 고로 if안에가 0이 아니면 트루이므로 이름이 같을때 들어온다 
                    im[i] = im[i + 1]; //다음 배열에 있는 값을 바로 앞에 있는 배열의 값에 대입
                }
            }
            else if ((idSearch.compare(im[i].getId()) && i == countFr - 1)) {
                cout << "검색 결과가 없습니다" << endl;
            };
                break;
        }
    }

    void FmDelete() { //정규직 삭제 함수
        string idSearch;
        cout << "삭제 할 사원 번호 : ";
        cin >> idSearch;
        for (int i = 0; i < countFr; i++) { //현재 총 배열의 갯수(countFr) 만큼 반복
            if (!idSearch.compare(fm[i].getId())) { //입력한 사원번호가 나올때 까지 검색
                                                    //im[i].getId();
                countFr--; //총 배열의 갯수가 하나 줄어드는것을 알기 위해 지정
                cout << "삭제 완료" << endl;
                for (i; i < countFr; i++) {//비교해서 같으면 0을 반환 고로 if안에가 0이 아니면 트루이므로 이름이 같을때 들어온다 
                    im[i] = im[i + 1]; //다음 배열에 있는 값을 바로 앞에 있는 배열의 값에 대입
                }
                //입력한 사원번호를 찾으면 for문 종료
            }
            else if ((idSearch.compare(fm[i].getId()) && i == countFr - 1)) {
                cout << "검색 결과가 없습니다" << endl;
            };
                break;
        }
    }

    void FullInput() { //정규직 입력 함수
        string fmin; //Info 입력 - info는 string으로 지정해줌
        float fminI; //Money, Time 입력 - Money랑 Time은 float로 지정해줌
        cout << "-----------개인 정보-----------" << endl;
        cout << "사원 번호    : ";
        cin >> fmin;
        fm[countFr].setId(fmin);//countFr이 위치하고 있는 배열에 저장
        cout << "이름         : ";
        cin >> fmin;
        fm[countFr].setName(fmin);
        cout << "주민등록번호 : ";
        cin >> fmin;
        fm[countFr].setSocialId(fmin);
        cout << "은행         : ";
        cin >> fmin;
        fm[countFr].setBank(fmin);
        cout << "계좌번호     : ";
        cin >> fmin;
        fm[countFr].setAccount(fmin);
        cout << "주소         : ";
        cin >> fmin;
        fm[countFr].setAddress(fmin);
        cout << "전화번호     : ";
        cin >> fmin;
        fm[countFr].setPhone(fmin);
        cout << "부서         : ";
        cin >> fmin;
        fm[countFr].setDepart(fmin);
        cout << "직급         : ";
        cin >> fmin;
        fm[countFr].setPosition(fmin);
        cout << "-----------급여 정보-----------" << endl;
        cout << "기본수당     : ";
        cin >> fminI;
        fm[countFr].setFound(fminI);
        cout << "시간         : ";
        cin >> fminI;
        fm[countFr].setHour(fminI);
        cout << "연장수당     : ";
        cin >> fminI;
        fm[countFr].setExtend(fminI);
        cout << "출근 일수    : ";
        cin >> fminI;
        fm[countFr].setDay(fminI);
        cout << "유급 휴가    : ";
        cin >> fminI;
        fm[countFr].setPvac(fminI);
        cout << "보너스       : ";
        cin >> fminI;
        fm[countFr].setBonus(fminI);
        cout << "만근 수당    : ";
        cin >> fminI;
        fm[countFr].setFull(fminI);
        fm[countFr].setMonthPay(fm[countFr].getFound()*fm[countFr].getHour());
        countFr++;
    }

    void IrrInput() {
        string imin;  //Info 입력 - info는 string으로 지정해줌
        float iminI; //Money, Time 입력 - Money랑 Time은 float로 지정해줌
        cout << "-----------개인 정보-----------" << endl;
        cout << "사원 번호    : ";
        cin >> imin;
        im[countIr].setId(imin); //countIr이 위치하고 있는 배열에 저장
        cout << "이름         : ";
        cin >> imin;
        im[countIr].setName(imin);
        cout << "주민등록번호 : ";
        cin >> imin;
        im[countIr].setSocialId(imin);
        cout << "은행         : ";
        cin >> imin;
        im[countIr].setBank(imin);
        cout << "계좌번호     : ";
        cin >> imin;
        im[countIr].setAccount(imin);
        cout << "주소         : ";
        cin >> imin;
        im[countIr].setAddress(imin);
        cout << "전화         : ";
        cin >> imin;
        im[countIr].setPhone(imin);
        cout << "부서         : ";
        cin >> imin;
        im[countIr].setDepart(imin);
        cout << "직급         : ";
        cin >> imin;
        im[countIr].setPosition(imin);
        cout << "-----------급여 정보-----------" << endl;
        cout << "기본 수당    : ";
        cin >> iminI;
        im[countIr].setFound(iminI);
        cout << "일한 시간    : ";
        cin >> iminI;
        im[countIr].setHour(iminI);
        cout << "출근 일수    : ";
        cin >> iminI;
        im[countIr].setDay(iminI);
        cout << "보너스       : ";
        cin >> iminI;
        im[countIr].setBonus(iminI);
        cout << "연장수당     : ";
        cin >> iminI;
        im[countIr].setExtend(iminI);
        im[countIr].setMonthPay(im[countIr].getFound()*im[countIr].getHour());

        countIr++;
    }

    void FullPrint(int p) {
        if (p == -1) { //0부터 시작하기 때문에 정보가 없으면 -1
            cout << "정보가 없습니다" << endl;
        }
        else {
            for (int i = 0; i < countFr; i++) { //현재 총 배열의 갯수(countFr) 만큼 반복해서 전체 출력 
                cout << "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓" << endl;
                cout << "-----------개인 정보-----------" << endl;
                cout << "사원 번호     : " << fm[i].getId() << endl;
                cout << "이름          : " << fm[i].getName() << endl;
                cout << "주민등록번호  : " << fm[i].getSocialId() << endl;
                cout << "은행          : " << fm[i].getBank() << endl;
                cout << "계좌번호      : " << fm[i].getAccount() << endl;
                cout << "주소          : " << fm[i].getAddress() << endl;
                cout << "전화번호      : " << fm[i].getPhone() << endl;
                cout << "부서          : " << fm[i].getDepart() << endl;
                cout << "직급          : " << fm[i].getPosition() << endl;
                cout << "-----------급여 정보-----------" << endl;
                cout << "월급          : " << fm[i].getMonthPay() << endl;
                cout << "연장수당      : " << fm[i].getExtend() << endl;
                cout << "출근 일수     : " << fm[i].getDay() << endl;
                cout << "유급 휴가     : " << fm[i].getPvac() << endl;
                cout << "보너스        : " << fm[i].getBonus() << endl;
                cout << "만근 수당     : " << fm[i].getFull() << endl;
                cout << "-----------세금 정보-----------" << endl;
                cout << "세금          : " << fm[i].getTax() << endl;
                cout << "-----------최종 정보-----------" << endl;
                cout << "총 급여       : " << fm[i].getTotalPay() << endl;
                cout << "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛" << endl;
                cout << endl;
            }
        }
    }

    void IrrPrint(int p) {
        if (p == -1) { //0부터 시작하기 때문에 정보가 없으면 -1
            cout << "정보가 없습니다" << endl;
        }
        else {
            for (int i = 0; i < countIr; i++) { //현재 총 배열의 갯수(countIr) 만큼 반복해서 전체 출력
                cout << "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓" << endl;
                cout << "-----------개인 정보-----------" << endl;
                cout << "사원 번호    : " << im[i].getId() << endl;
                cout << "이름         : " << im[i].getName() << endl;
                cout << "주민등록번호 : " << im[i].getSocialId() << endl;
                cout << "은행         : " << im[i].getBank() << endl;
                cout << "계좌번호     : " << im[i].getAccount() << endl;
                cout << "주소         : " << im[i].getAddress() << endl;
                cout << "전화번호     : " << im[i].getPhone() << endl;
                cout << "부서         : " << im[i].getDepart() << endl;
                cout << "직급         : " << im[i].getPosition() << endl;
                cout << "-----------급여 정보-----------" << endl;
                cout << "월급         : " << im[i].getMonthPay() << endl;
                cout << "연장수당     : " << im[i].getExtend() << endl;
                cout << "-----------세금 정보-----------" << endl;
                cout << "세금         : " << im[i].getTax() << endl;
                cout << "-----------최종 정보-----------" << endl;
                cout << "총 급여      : " << im[i].getTotalPay() << endl;
                cout << "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛" << endl;
                cout << endl;
            }
        }
    }

    void FullPrintOne(int i) { //위치를 i에 받아서 그 위치에 대한 배열만 출력 (1명)
        cout << "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓" << endl;
        cout << "-----------개인 정보-----------" << endl;
        cout << "사원 번호     : " << fm[i].getId() << endl;
        cout << "이름          : " << fm[i].getName() << endl;
        cout << "주민등록번호  : " << fm[i].getSocialId() << endl;
        cout << "은행          : " << fm[i].getBank() << endl;
        cout << "계좌번호      : " << fm[i].getAccount() << endl;
        cout << "주소          : " << fm[i].getAddress() << endl;
        cout << "전화번호      : " << fm[i].getPhone() << endl;
        cout << "부서          : " << fm[i].getDepart() << endl;
        cout << "직급          : " << fm[i].getPosition() << endl;
        cout << "-----------급여 정보-----------" << endl;
        cout << "월급          : " << fm[i].getMonthPay() << endl;
        cout << "연장수당      : " << fm[i].getExtend() << endl;
        cout << "출근 일수     : " << fm[i].getDay() << endl;
        cout << "유급 휴가     : " << fm[i].getPvac() << endl;
        cout << "보너스        : " << fm[i].getBonus() << endl;
        cout << "만근 수당     : " << fm[i].getFull() << endl;
        cout << "-----------세금 정보-----------" << endl;
        cout << "세금          : " << fm[i].getTax() << endl;
        cout << "-----------최종 정보-----------" << endl;
        cout << "총 급여       : " << fm[i].getTotalPay() << endl;
        cout << "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛" << endl;
        cout << endl;
    }

    void IrrPrintOne(int i) { //위치를 i에 받아서 그 위치에 대한 배열만 출력 (1명)
        cout << "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓" << endl;
        cout << "-----------개인 정보-----------" << endl;
        cout << "사원 번호    : " << im[i].getId() << endl;
        cout << "이름         : " << im[i].getName() << endl;
        cout << "주민등록번호 : " << im[i].getSocialId() << endl;
        cout << "은행         : " << im[i].getBank() << endl;
        cout << "계좌번호     : " << im[i].getAccount() << endl;
        cout << "주소         : " << im[i].getAddress() << endl;
        cout << "전화번호     : " << im[i].getPhone() << endl;
        cout << "부서         : " << im[i].getDepart() << endl;
        cout << "직급         : " << im[i].getPosition() << endl;
        cout << "-----------급여 정보-----------" << endl;
        cout << "월급         : " << im[i].getMonthPay() << endl;
        cout << "연장수당     : " << im[i].getExtend() << endl;
        cout << "-----------세금 정보-----------" << endl;
        cout << "세금         : " << im[i].getTax() << endl;
        cout << "-----------최종 정보-----------" << endl;
        cout << "총 급여      : " << im[i].getTotalPay() << endl;
        cout << "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛" << endl;
        cout << endl;
    }
}; 

 

Main 함수

void main() {
    Master m;
    string password;
    int pos = 0;
    int sel = 0;
    int choose = 0;
    cout << " ⊂_ \                       " << endl;
    cout << "    \\Λ_Λ                  " << endl;
    cout << "     \ ('ㅅ') 두둠칫         " << endl;
    cout << "        > ⌒ \               " << endl;
    cout << "       /     へ\              " << endl;
    cout << "      /   / \\             " << endl;
    cout << "     /   ノ \_つ            " << endl;
    cout << "    /   / 두둠칫              " << endl;
    cout << "   / /  |                     " << endl;
    cout << "  (  (   \                    " << endl;
    cout << "  |  |  、\                   " << endl;
    cout << "  | /    \⌒)                  " << endl;
    cout << "  | |     ) /                  " << endl;
    cout << "`ノ )   L/                    " << endl;
    while (sel != 3) {
        cout << "메뉴" << endl;
        cout << "1.사용자  2.관리자  3.끝내기" << endl;
        cout << "선택 : ";
        cin >> sel;
        switch (sel) {
        case 1: { //사용자
            while (choose != 2) {
                cout << "1.조회  2.메뉴" << endl;
                int user;
                cout << "선택 : ";
                cin >> user;
                switch (user) {
                case 1: { //조회
                    cout << "1.정규직  2.계약직" << endl;
                    cout << "선택 : ";
                    int find;
                    cin >> find;
                    switch (find) {
                    case 1: {
                        m.FullPrintOne(m.FmSearch()); //위치함수에서 실행 후, 1명 출력
                    }break;

                    case 2: {
                        m.IrrPrintOne(m.ImSearch()); //위치함수에서 실행 후, 1명 출력
                    }break;
                    }
                }break;

                case 2: { //메뉴
                    cout << "메뉴로 돌아갑니다" << endl;
                }break;

                default:
                    cout << "잘못된 입력입니다" << endl;
                }
                break;
            }
            break;
        case 2: {//관리자
            cout << "비밀번호 입력 : ";
            cin >> password;
            system("cls");
            if (password != "1234") {
                cout << "비밀번호가 틀렸습니다" << endl;
            }
            else {
                int manage = 1;
                while (manage != 6) {
                    cout << "               메뉴를 선택하세요" << endl;
                    cout << "1.입력  2.출력  3.검색  4.수정  5.삭제  6.메뉴" << endl;
                    cout << "선택 : ";
                    cin >> manage;
                    switch (manage) {
                    case 1: { //입력
                        cout << "1.정규직  2.계약직  3.돌아가기" << endl;
                        cout << "선택 : ";
                        int input = 0;
                        cin >> input;
                        switch (input) {
                        case 1: { //정규직 입력
                            system("cls");
                            m.FullInput();
                            cout << endl << "   정규직 사원 입력완료" << endl;
                            Sleep(1000);
                            system("cls");
                        }break;

                        case 2: {//계약직 입력
                            system("cls");
                            m.IrrInput();
                            cout << endl << "   계약직 사원 입력완료" << endl;
                            Sleep(1000);
                            system("cls");
                        }break;

                        case 3: {//돌아가기
                        }break;

                        }
                        break;
                    }

                    case 2: {//출력
                        cout << "1.정규직  2.계약직" << endl;
                        cout << "선택 : ";
                        int printC;
                        cin >> printC;
                        switch (printC) {
                        case 1: {
                            cout.setf(ios::left);
                            cout << setw(45) << "---------------정규직 사원 명단" << endl;
                            cout << endl;
                            m.FullPrint(m.getCountFr()); //입력한 갯수를 받아서, 그 갯수만큼 출력
                        }break;

                        case 2: {
                            cout.setf(ios::left);
                            cout << setw(45) << "---------------계약직 사원 명단" << endl;
                            cout << endl;
                            m.IrrPrint(m.getCountIr()); //입력한 갯수를 받아서, 그 갯수만큼 출력
                        }break;
                        }
                    }break;

                    case 3: {//검색
                        cout << "1.정규직  2.계약직" << endl;
                        cout << "선택 : ";
                        int find;
                        cin >> find;
                        system("cls");
                        switch (find) {
                        case 1: {
                            m.FullPrintOne(m.FmSearch());
                        }break;

                        case 2: {
                            m.IrrPrintOne(m.ImSearch());
                        }break;

                        }
                    }break;

                    case 4: {//수정
                        cout << "1.정규직  2.계약직" << endl;
                        cout << "선택 : ";
                        int fix;
                        cin >> fix;
                        switch (fix) {
                        case 1: {
                            m.FmFix(m.FmSearch()); //위치함수에서 실행 후, 1명 출력
                        }break;

                        case 2: {
                            m.ImFix(m.ImSearch()); //위치함수에서 실행 후, 1명 출력
                        }break;

                        }
                    }break;

                    case 5: {//삭제
                        cout << "1.정규직  2.계약직" << endl;
                        cout << "선택 : ";
                        int del;
                        cin >> del;
                        switch (del) {
                        case 1: {
                            m.FmDelete();
                        }break;
                        case 2: {
                            m.ImDelete();
                        }break;
                        }
                    } break;

                    case 6: {//돌아가기
                        cout << "메뉴로 돌아갑니다" << endl;

                    }break;

                    }
                }
            }
            break;
        }
                break;
        case 3: {
            cout << "종료됩니다" << endl;
            break;
        }
        }
        }
    }
}

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

[C++] ABSTRACT CLASS - 추상 클래스  (0) 2018.03.13
[C++] MULTIPLE INHERITANCE - 다중 상속  (0) 2018.03.13
[C++] CLASS RELATIONSHIP - 클래스 관계  (0) 2018.03.08
[C++] CONST  (0) 2018.03.08
[C++] STATIC  (0) 2018.03.08
댓글