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