<div>void main()<br>{<br> string a1, a2, b1, b2;<br> int a3, b3, a;<br> Employee Employee1(a1, a2, a3), Employee2(b1, b2, b3);</div> <div> while (1)<br> {<br> cout << "1. 2. 3. 4." << endl << "Select the number : ";<br> cin >> a;<br> switch (a)<br> {<br> case 1: //이름,성,월급 입력<br> while (1)<br> {<br> cout << "Employee1 first name : ";<br> getline(cin, a1);//얘가 묻힘<br> cout << "Employee1 last name : ";<br> getline(cin, a2);<br> cout << "Employee1 salary : ";<br> cin >> a3;</div> <div><br> cout << "Employee2 first name : ";<br> getline(cin, b1);//얘가 묻힘<br> cout << "Employee2 last name : ";<br> getline(cin, b2);<br> cout << "Employee2 salary : ";<br> cin >> b3;<br> }<br> break;<br> case 2: //연봉<br> Employee1.getsalary();//실행안됨 ㅠㅠㅠㅠㅠ<br> break;<br> case 3: //성과급반영연봉<br> break;<br> }<br> }<br>}</div> <div> </div> <div>얘는 메인함수이고</div> <div> </div> <div>//Employee.cpp</div> <div>#include <iostream><br>using std::cout;<br>using std::endl;<br>using std::cin;</div> <div>#include "Employee.h"</div> <div>Employee::Employee(string a,string b,int c)<br>{<br> setfirst_name(a);<br> setlast_name(b);<br> setsalary(c);<br>}<br>void Employee::setfirst_name(string a)<br>{<br> first_name = a;<br>}<br>void Employee::getfirst_name()<br>{<br> cout << first_name;<br>}<br>void Employee::setlast_name(string b)<br>{<br> last_name = b;<br>}<br>void Employee::getlast_name()<br>{<br> cout << last_name;<br>}<br>void Employee::setsalary(int c)<br>{<br> salary = c;<br> if (salary < 0)<br> {<br> cout << "Error : Initial salary is " << endl;<br> salary = 0;<br> }<br>}<br>void Employee::getsalary()<br>{<br> cout << salary;<br>}</div> <div> </div> <div>얘는 클래스의 내용입니다</div> <div> </div> <div>퍼스트네임 입력을 하는 부분인 getline에서 묻히더라구요</div> <div> </div> <div>Employee1.getsalary();//실행안됨 ㅠㅠㅠㅠㅠ</div> <div> </div> <div>그리고 이줄 때문에 콘솔창 실해이 안되는거 같은데.. 이유좀 알려주세요 ㅠㅠㅠㅠ</div>
댓글 분란 또는 분쟁 때문에 전체 댓글이 블라인드 처리되었습니다.