에러좀 잡아주십시오...
재바우
인력관리프로그램인데 제가 어느정도 다짯는데 오류가 안잡히네요
#pragma once#include string
using namespace std;
class CPerson{private: string name; string tel; string address; string id;public: CPerson(void); ~CPerson(void);
virtual void SearchName(string name); virtual void SearchDept(string dept); virtual void SearchClub(string club); virtual void DeleteName(string name); virtual void ShowFaculty(); virtual void ShowGraduate(); virtual void ShowStaff(); virtual void ShowUnderGraduate(); virtual string getTutor(); virtual string getDept(); virtual string getWork(); virtual string getOffice(); virtual string getClub(); virtual string getStudy(); virtual string getGrade();
string getId(); string getName(); string getTel(); string getAddress(); void setId(string Id); void setName(string name); void setTel(string tel); void setAddress(string address);};
------------------------------------------------------#include CPerson.h
CPerson::CPerson(void){}
CPerson::~CPerson(void){}
void CPerson::DeleteName(string name){
}
void CPerson::SearchName(string name){
}
void CPerson::SearchDept(string dept){
}
void CPerson::SearchClub(string club){
}
string CPerson::getId(){ return id;}
void CPerson::setId(string id){ this-id = id;}
string CPerson::getName(){ return name;}
string CPerson::getTel(){ return tel;}
string CPerson::getAddress(){ return address;}
void CPerson::setName(string name){ this-name = name;}
void CPerson::setTel(string tel){ this-tel = tel;}
void CPerson::setAddress(string address){ this-address = address;}
void CPerson::ShowFaculty(){}
void CPerson::ShowGraduate(){}
void CPerson::ShowStaff(){}
void CPerson::ShowUnderGraduate(){ }==========================================================#pragma once#include CPerson.h#include iostream#include string
using namespace std;
class CFaculty : public CPerson{private: string dept; string study; string office;public: CFaculty(string id, string dept, string study, string office, string name, string tel, string address); ~CFaculty(void);
string getDept(); string getStudy(); string getOffice(); void setDept(string dept); void setStudy(string study); void setOffice(string office); string getTutor(); string getWork(); string getClub(); string getGrade();
void ShowFaculty(); void ShowGraduate(); void ShowStaff(); void ShowUnderGraduate(); void DeleteName(string name); void SearchName(string name); void SearchDept(string dept);};
=============================================================
#include CFaculty.h#include iostream#include string
CFaculty::CFaculty(string id, string dept, string study, string office, string name, string tel, string address){ this-setName(name); this-setTel(tel); this-setAddress(address); this-setId(id); this-dept = dept; this-study = study; this-office = office;}
CFaculty::~CFaculty(void){}
string CFaculty::getGrade(){ return ;}
string CFaculty::getTutor(){ return ;}
string CFaculty::getWork(){ return ;}
string CFaculty::getClub(){ return ;}
string CFaculty::getDept(){ return dept;}
string CFaculty::getStudy(){ return study;}
string CFaculty::getOffice(){ return office;}
void CFaculty::setDept(string dept){ this-dept = dept;}
void CFaculty::setStudy(string study){ this-study = study;}
void CFaculty::setOffice(string office){ this-office = office;}
void CFaculty::ShowFaculty(){ if(this-getId().substr(0,1) == F) coutthis-getId(),this-getDept(),this-getStudy(),this-getOffice(),this-getName(),this-getTel(),this-getAddress()endl;}void CFaculty::ShowGraduate(){}
void CFaculty::ShowStaff(){}
void CFaculty::ShowUnderGraduate(){}
void CFaculty::DeleteName(string name){ if(this-getName() == name) { cout삭제endl; coutthis-getId(),this-getDept(),this-getStudy(),this-getOffice(),this-getName(),this-getTel(),this-getAddress()endl;
}}
void CFaculty::SearchName(string name){ if(this-getName() == name) { coutthis-getId(),this-getDept(),this-getStudy(),this-getOffice(),this-getName(),this-getTel(),this-getAddress()endl; }}
void CFaculty::SearchDept(string dept){ if(this-getDept() == dept) { coutthis-getId(),this-getDept(),this-getStudy(),this-getOffice(),this-getName(),this-getTel(),this-getAddress()endl; }}================================================================#pragma once#include CStudent.h#include iostream#include string
using namespace std;
class CGraduate : public CStudent{private: int grade; string dept; string tutor; string study; string office;public: CGraduate(string sid, string grade, string dept, string tutor, string study, string office, string name, string tel, string address); ~CGraduate(void);
string getStudy(); string getOffice(); void setStudy(string study); void setOffice(string office); string getClub();
string getWork();
void ShowFaculty(); void ShowGraduate(); void ShowStaff(); void ShowUnderGraduate(); void SearchName(string name); void SearchDept(string dept);
};
=============================================================
#include CGraduate.h
CGraduate::CGraduate(string sid, string grade, string dept, string tutor, string study, string office, string name, string tel, string address){ this-setName(name); this-setTel(tel); this-setAddress(address); this-setId(sid); this-setGrade(grade); this-setDept(dept); this-setTutor(tutor); this-study = study; this-office = office;
}
CGraduate::~CGraduate(void){}
string CGraduate::getWork(){ return ;}
string CGraduate::getClub(){ return ;}
string CGraduate::getStudy(){ return study;}
string CGraduate::getOffice(){ return office;}
void CGraduate::setStudy(string study){ this-study = study;}
void CGraduate::setOffice(string office){ this-office = office;}
void CGraduate::ShowFaculty(){}
void CGraduate::ShowGraduate(){ if(this-getId().substr(0,1) == G) coutthis-getId(),this-getGrade(),this-getDept(),this-getTutor(),this-getStudy(),this-getOffice(),this-getName(),this-getTel(),this-getAddress()endl;}
void CGraduate::ShowStaff(){}
void CGraduate::ShowUnderGraduate(){}
void CGraduate::SearchName(string name){ if(this-getName() == name) coutthis-getId(),this-getGrade(),this-getDept(),this-getTutor(),this-getStudy(),this-getOffice(),this-getName(),this-getTel(),this-getAddress()endl;}
void CGraduate::SearchDept(string dept){ if(this-getDept() == dept) coutthis-getId(),this-getGrade(),this-getDept(),this-getTutor(),this-getStudy(),this-getOffice(),this-getName(),this-getTel(),this-getAddress()endl;
}=================================================================
#pragma once#include CPerson.h#include iostream#include string
using namespace std;
class CStaff : public CPerson{private: string dept; string work; string office;public: CStaff(string id, string dept, string work, string office, string name, string tel, string address); ~CStaff(void);
string getDept(); string getWork(); string getOffice(); void setDept(string dept); void setWork(string work); void setOffice(string office); string getTutor(); string getClub(); string getStudy(); string getGrade();
void ShowFaculty(); void ShowGraduate(); void ShowStaff(); void ShowUnderGraduate(); void DeleteName(string name); void SearchName(string name); void SearchDept(string dept);
};
=========================================================#include CStaff.h#include iostream#include string
CStaff::CStaff(string id, string dept, string work, string office, string name, string tel, string address){ this-setName(name); this-setTel(tel); this-setAddress(address); this-setId(id); this-dept = dept; this-work = work; this-office = office;
}
CStaff::~CStaff(void){}
string CStaff::getGrade(){ return ;}
string CStaff::getClub(){ return ;}
string CStaff::getStudy(){ return ;}
string CStaff::getTutor(){ return ;}
string CStaff::getDept(){ return dept;}
string CStaff::getWork(){ return work;}
string CStaff::getOffice(){ return office;}
void CStaff::setDept(string dept){ this-dept = dept;}
void CStaff::setWork(string work){ this-work = work;}
void CStaff::setOffice(string office){ this-office = office;}
void CStaff::ShowFaculty(){}
void CStaff::ShowGraduate(){}
void CStaff::ShowStaff(){ if(this-getId().substr(0,1) == S) coutthis-getId(),this-getDept(),this-getWork(),this-getOffice(),this-getName(),this-getTel(),this-getAddress()endl;}
void CStaff::ShowUnderGraduate(){}
void CStaff::DeleteName(string name){ if(this-getName() == name) {
}}
void CStaff::SearchName(string name){ if(this-getName() == name) coutthis-getId(),this-getDept(),this-getWork(),this-getOffice(),this-getName(),this-getTel(),this-getAddress()endl;}
void CStaff::SearchDept(string dept){ if(this-getDept() == dept) coutthis-getId(),this-getDept(),this-getWork(),this-getOffice(),this-getName(),this-getTel(),this-getAddress()endl;
}
=========================================================#pragma once#include iostream#include CPerson.h
using namespace std;
class CStudent : public CPerson{private: string grade; string dept; string tutor;public: CStudent(void); ~CStudent(void);
string getGrade(); string getDept(); string getTutor(); void setGrade(string grade); void setDept(string dept); void setTutor(string tutor); void ShowFaculty(); void ShowGraduate(); void ShowStaff(); void ShowUnderGraduate(); };
=======================================================
#include CStudent.h
CStudent::CStudent(void){}
CStudent::~CStudent(void){}
string CStudent::getGrade(){ return grade;}
string CStudent::getDept(){ return dept;}
string CStudent::getTutor(){ return tutor;}
void CStudent::setGrade(string grade){ this-grade = grade;}
void CStudent::setDept(string dept){ this-dept = dept;}
void CStudent::setTutor(string tutor){ this-tutor = tutor;}
void CStudent::ShowFaculty(){}
void CStudent::ShowGraduate(){}
void CStudent::ShowStaff(){}
void CStudent::ShowUnderGraduate(){ }=====================================================#pragma once#include CStudent.h#include iostream#include string
using namespace std;
class CUnderGraduate : public CStudent{private: int grade; string dept; string tutor; string club;public: CUnderGraduate(strinte(string sid, string grade, string dept, string tutor, string club, string name, string tel, string address); ~CUnderGraduate(void);
void SearchClub(string club);
string getClub(); void setClub(string club); string getWork(); string getOffice(); string getStudy();
void ShowFaculty(); void ShowGraduate(); void ShowStaff(); void ShowUnderGraduate(); void DeleteName(string name); void SearchName(string name); void SearchDept(string dept);};====================================================#include CUnderGraduate.h
CUnderGraduate::CUnderGraduate(string sid, string grade, string dept, string tutor, string club, string name, string tel, string address){ this-setName(name); this-setTel(tel); this-setAddress(address); this-setId(sid); this-setGrade(grade); this-setDept(dept); this-setTutor(tutor); this-club = club;}
CUnderGraduate::~CUnderGraduate(void){}
string CUnderGraduate::getWork(){ return ;}
string CUnderGraduate::getOffice(){ return ;}
string CUnderGraduate::getStudy(){ return ;}
string CUnderGraduate::getClub(){ return club;}
void CUnderGraduate::setClub(string club){ this-club = club;}
void CUnderGraduate::ShowFaculty(){}
void CUnderGraduate::ShowGraduate(){}
void CUnderGraduate::ShowStaff(){}
void CUnderGraduate::ShowUnderGraduate(){ if(this-getId().substr(0,1) == U) coutthis-getId(),this-getGrade(),this-getDept(),this-getTutor(),this-getClub(),this-getName(),this-getTel(),this-getAddress()endl;}
void CUnderGraduate::DeleteName(string name){ if(this-getName() == name) {
}}
void CUnderGraduate::SearchName(string name){ if(this-getName() == name) coutthis-getId(),this-getGrade(),this-getDept(),this-getTutor(),this-getClub(),this-getName(),this-getTel(),this-getAddress()endl;}
void CUnderGraduate::SearchDept(string dept){ if(this-getDept() == dept) coutthis-getId(),this-getGrade(),this-getDept(),this-getTutor(),this-getClub(),this-getName(),this-getTel(),this-getAddress()endl;}
void CUnderGraduate::SearchClub(string club){ if(this-getClub() == club) coutthis-getId(),this-getGrade(),this-getDept(),this-getTutor(),this-getClub(),this-getName(),this-getTel(),this-getAddress()endl;}============================================================#pragma once#include iostream#include fstream#include string#include CFaculty.h#include CGraduate.h#include CPerson.h#include CStaff.h#include CStudent.h#include CUnderGraduate.h
using namespace std;
#define MAX 100
class iohandler{private: CPerson *p[MAX]; int count;public: iohandler(); ~iohandler(void);
int inFile(CPerson * _p[]); void outFile(CPerson * p[], int count, string val1, string val2, string val3, string val4, string val5, string val6, string val7, string val8 = , string val9 = );
CPerson *getPerson();};===============================================================
#include iohandler.h
iohandler::iohandler(void){}
iohandler::~iohandler(void){}
CPerson * iohandler::getPerson(){ return p[MAX];}
int iohandler::inFile(CPerson * p[]){ char str[100]; string menu; string val1, val2, val3, val4, val5, val6, val7, val8, val9; ifstream fstream in; int count =0;
in.open(data.txt);
if(!in) { cout파일을 열 수 없음endl; return 0; }
while(!in.eof()) { getline(in,menu); if(menu == 교수) { while(1) { in.getline(str,100);
val1 = strtok(str,,);
if(val1==직원) { menu = val1; break; }
val2 = strtok(NULL, ,); val3 = strtok(NULL, ,); val4 = strtok(NULL, ,); val5 = strtok(NULL, ,); val6 = strtok(NULL, ,); val7 = strtok(NULL, ,);
p[count++] = new CFaculty(val1,val2,val3,val4,val5,val6,val7); } }
if(menu == 직원) { while(1) { in.getline(str,100); val1 = strtok(str,,);
if(val1==대학생) { menu = val1; break; }
val2 = strtok(NULL, ,); val3 = strtok(NULL, ,); val4 = strtok(NULL, ,); val5 = strtok(NULL, ,); val6 = strtok(NULL, ,); val7 = strtok(NULL, ,);
p[count++] = new CStaff(val1, val2, val3, val4, val5, val6, val7); } }
if(menu == 대학생) { while(1) { in.getline(str,100); val1 = strtok(str,,);
if(val1==대학원생) { menu = val1; break; }
val2 = strtok(NULL, ,); val3 = strtok(NULL, ,); val4 = strtok(NULL, ,); val5 = strtok(NULL, ,); val6 = strtok(NULL, ,); val7 = strtok(NULL, ,); val8 = strtok(NULL, ,);
p[count++] = new CUnderGraduate(val1,val2,val3,val4,val5,val6,val7,val8); } }
if(menu == 대학원생) { while(!in.eof()) { in.getline(str,100); val1 = strtok(str,,); val2 = strtok(NULL, ,); val3 = strtok(NULL, ,); val4 = strtok(NULL, ,); val5 = strtok(NULL, ,); val6 = strtok(NULL, ,); val7 = strtok(NULL, ,); val8 = strtok(NULL, ,); val9 = strtok(NULL, ,);
p[count++] = new CGraduate(val1,val2,val3,val4,val5,val6,val7,val8,val9); } } }
in.close();
return count;}
void iohandler::outFile(CPerson * p[], int count, string val1, string val2, string val3, string val4, string val5, string val6, string val7, string val8, string val9){ ofstream out; out.open(data.txt,ios::trunc); out교수endl; for(int i=0;icount;i++) { if(p[i]-getId().substr(0,1)==F) { outp[i]-getId(),p[i]-getDept(),p[i]-getStudy(),p[i]-getOffice(),p[i]-getName(),p[i]-getTel(),p[i]-getAddress()endl; } }
out직원endl; for(int i=0;icount;i++) { if(p[i]-getId().substr(0,1)==S) { outp[i]-getId(),p[i]-getDept(),p[i]-getWork(),p[i]-getOffice(),p[i]-getName(),p[i]-getTel(),p[i]-getAddress()endl; } }
out대학생endl; for(int i=0;icount;i++) { if(p[i]-getId().substr(0,1)==U) { outp[i]-getId(),p[i]-getGrade(),p[i]-getDept(),p[i]-getTutor(),p[i]-getClub(),p[i]-getName(),p[i]-getTel(),p[i]-getAddress()endl; } }
out대학원생endl; for(int i=0;icount;i++) { if(p[i]-getId().substr(0,1)==G) { outp[i]-getId(),p[i]-getGrade(),p[i]-getDept(),p[i]-getTutor(),p[i]-getStudy(),p[i]-getOffice(),p[i]-getName(),p[i]-getTel(),p[i]-getAddress()endl; } } cout\b; out.close();}
=========================================================
#include iostream#include CPerson.h#include CFaculty.h#include CGraduate.h#include CStaff.h#include CUnderGraduate.h#include iohandler.h#include string
using namespace std;
#define MAX 100
int main(){ iohandler io; CPerson * p[MAX]; int sel, menu; int n; string temp1, temp; string val1,val2,val3,val4,val5,val6,val7,val8,val9;
int count = io.inFile(p);
while(1) { cout1.인력입력endl2.인력출력endl3.인력삭제endl4.인력검색endl5.종료endl; cinsel;
switch(sel) { case 1: cout1.1 교수 입력endl; cout1.2 직원 입력endl; cout1.3 대학생 입력endl; cout1.4 대학원생 입력endl; cout입력 대상을 고르시오 : ; cinmenu; switch(menu) { case 1: cout교수 정보를 입력하시오.(사번, 학과, 전공, 연구실, 이름, 연락처, 주소 순으로 입력)endl; cinval1val2val3val4val5val6val7; p[count] = new CFaculty(val1, val2, val3, val4, val5, val6, val7); io.outFile(p, count, val1, val2, val3, val4, val5, val6, val7); count++; break; case 2: cout직원 정보를 입력하시오.(사번, 학과, 업무, 사무실, 이름, 연락처, 주소 순으로 입력)endl; cinval1val2val3val3val4val5val6val7; p[count] = new CStaff(val1, val2, val3, val4, val5, val6, val7); io.outFile(p, count, val1, val2, val3, val4, val5, val6, val7); count++; break; case 3: cout대학생 정보를 입력하시오.(학번, 학년, 학과, 지도교수, 동아리, 이름, 연락처, 주소 순으로 입력)endl; cinval1val2val3val4val5val6val7val8; n=0; for(int i=0;icount;i++) { if(p[i]-getName() == val4) n++; } if(n==0) { cout지도교수가 없음endl; break; } p[count] = new CUnderGraduate(val1, val2, val3, val4, val5, val6, val7, val8); io.outFile(p, count, val1, val2, val3, val4, val5, val6, val7, val8); count++; break; case 4: cout대학원생 정보를 입력하시오.(학번, 학년, 학과, 지도교수, 전공, 연구실, 이름, 연락처, 주소 순으로 입력)endl; cinval1val2val3val4val5val6val7val8val9; n=0; for(int i=0;icount;i++) { if(p[i]-getName() == val4) n++; } if(n==0) { cout지도교수가 없음endl; break; } p[count] = new CGraduate(val1, val2, val3, val4, val5, val6, val7, val8, val9); io.outFile(p, count, val1, val2, val3, val4, val5, val6, val7, val8, val9); count++; break; default: cout잘못된 입력입니다.endl; break; }
break; case 2: cout2.1 모두 출력endl; cout2.2 교수 출력endl; cout2.3 직원 출력endl; cout2.4 대학생 출력endl; cout2.5 대학원생 출력endl; cinmenu;
switch(menu) { case 1: cout모든 정보를 출력합니다.endl; for(int i=0;icount;i++) { p[i]-ShowFaculty(); p[i]-ShowGraduate(); p[i]-ShowStaff(); p[i]-ShowUnderGraduate(); }
break; case 2: cout교수 정보를 출력합니다.endl; for(int i=0;icount;i++) { p[i]-ShowFaculty(); }
break; case 3: cout직원 정보를 출력합니다.endl; for(int i=0;icount;i++) { p[i]-ShowStaff(); }
break; case 4: cout대학생 정보를 출력합니다.endl; for(int i=0;icount;i++) { p[i]-ShowUnderGraduate(); }
break; case 5: cout대학원생 정보를 출력합니다.endl; for(int i=0;icount;i++) { p[i]-ShowGraduate(); }
break; default: break; }
break; case 3: cout3.1 교수 삭제endl; cout3.2 직원 삭제endl; cout3.3 대학생 삭제endl; cout3.4 대학원생 삭제endl; cinmenu;
switch(menu) { case 1: cout삭제할 교수 이름을 입력하시오.; cintemp1; n=0; for(int i=0;icount;i++) { if(p[i]-getTutor() == temp1) n++; }
if(n0) { cout지도학생이 있음endl; break; }
for(int i=0;icount;i++) { if(p[i]-getName() == temp1) { p[i]-~CPerson(); for(int j=i+1;jcount;j++) { p[j] = p[j-1]; } } } count--; io.outFile(p, count, val1, val2, val3, val4, val5, val6, val7); break;d case 2: cout삭제할 직원 이름을 입력하시오.; cintemp1; for(int i=0;icount;i++) { if(p[i]-getName() == temp1) { p[i]-~CPerson(); for(int j=i+1;jcount;j++) { p[j] = p[j-1]; } } } count--; io.outFile(p, count, val1, val2, val3, val4, val5, val6, val7); break; case 3: cout삭제할 대학생 이름을 입력하시오.; cintemp1; for(int i=0;icount;i++) { if(p[i]-getName() == temp1) { p[i]-~CPerson(); for(int j=i+1;jcount;j++) { p[j] = p[j-1]; } } } count--; io.outFile(p, count, val1, val2, val3, val4, val5, val6, val7); break; case 4: cout삭제할 대학원생 이름을 입력하시오.; cintemp1; for(int i=0;icount;i++) { if(p[i]-getName() == temp1) { p[i]-~CPerson(); for(int j=i+1;jcount;j++) { p[j] = p[j-1]; } } } count--; io.outFile(p, count, val1, val2, val3, val4, val5, val6, val7); break; default: cout잘못된 입력입니다.; break; }
break; case 4: cout4.1 이름 검색endl; cout4.2 학과 검색endl; cout4.3 동아리 검색endl; cinmenu;
switch(menu) { case 1: cout검색할 이름을 입력하시오. : ; cintemp1; for(int i=0;icount;i++) { p[i]-SearchName(temp1); } break; case 2: cout검색할 학과명을 입력하시오. : ; cintemp1; for(int i=0;icount;i++) { p[i]-SearchDept(temp1); } break; case 3: cout검색할 동아리를 입력하시오. : ; cintemp1; for(int i=0;icount;i++) { p[i]-SearchClub(temp1); } break; default: break; }
break; case 5: cout프로그램을 종료합니다.endl; exit(1); break; default: cout잘못된 입력endl; exit(1); break; } }
for(int i=0;icount;i++) delete p[i];
return 0;}
번호 | 제 목 | 글쓴이 | 날짜 |
---|---|---|---|
2695766 | 달팽이 배열 어디서 틀렸는지 모르겠습니다ㅠㅠ | 연분홍 | 2025-05-23 |
2695738 | fopen과fclose질문~~ (5) | 희선 | 2025-05-23 |
2695707 | 3의 배수 나타내기. (2) | 수리 | 2025-05-23 |
2695626 | 피보나치수열 과제 때문에 질문 드립니다. (6) | 옆집언니 | 2025-05-22 |
2695595 | 포인트공부중입니다 int형에서 4=1 인가요? (3) | 족장 | 2025-05-22 |
2695567 | 드라이브 고유번호를 가져오는 함수 (2) | 초코맛사탕 | 2025-05-21 |
2695533 | 음수의 산술변환! 질문이요 ㅠㅠ... (4) | 꽃여름 | 2025-05-21 |
2695506 | 구조체 배열 이용 도서목록 출력 프로그램 (1) | 가을귀 | 2025-05-21 |
2695450 | c언어 함수 질문이요.... | 이슬비 | 2025-05-20 |
2695403 | VirtualAlloc함수 및 메모리 질문 | 크리에이터 | 2025-05-20 |
2695355 | c언어 for함수 | 미쿡 | 2025-05-19 |
2695327 | 안녕하세요 제가 이번에 좀 큰 프로그램을.. | 악당 | 2025-05-19 |
2695295 | mutex동기화의 thread기반 채팅 서버소스 질문입니다 | 그루터기 | 2025-05-19 |
2695270 | 질문이요..swap 관한겁니다..ㅠㅠ (3) | 콩알녀 | 2025-05-19 |
2695244 | 노땅초보궁금한게 하나 있는데요..반복문(while문)초보자질문 (6) | 큰꽃늘 | 2025-05-18 |
2695166 | do while 문 어떤것이잘못된건지 모르겠어요 (2) | 아이폰 | 2025-05-18 |
2695122 | 구조체에 대해 물어보고 싶은게 있습니다 ^^^.. (7) | 수련 | 2025-05-17 |
2695091 | txt 파일 입출력 후 2차 배열에 저장하기입니다. (3) | 헛장사 | 2025-05-17 |
2695063 | 수도요금 프로그램좀 짜주세요. | 시내 | 2025-05-17 |
2695033 | 답변좀요ㅠㅠ (1) | 비사벌 | 2025-05-16 |