0

I only have one error in my main program. So I coded a program using OOP that intakes how many years you've worked in a certain company and calculates your received bonus. However it seems to skip my initial input statement "Enter your firstname". It works just fine without the if else statement. What should I do to fix this?

`

int main()
{
    ASE employee1;
    SE employee2;
    string a, b, c;
    int d, e;
    char determine;

    cout << "Are you an ASE?: [1]Yes [Any]No";
        cin >> determine;

    if (determine == '1')
    {
        cout << "Enter your firstname: ";
        getline(cin, a);
        cout << "Enter your lastname: ";
        getline(cin, b);
        cout << "Enter your birthday: ";
        getline(cin, c);
        employee1.setbirthday(c);
        cout << "Enter your age: ";
        cin >> d;
        employee1.setage(d);
        cout << "Enter your age when you entered the company: ";
        cin >> e;
        employee1.setageCompany(e);
        cout << endl << "Hello, " << employee1.setfirstName(a) << " " << employee1.setlastName(b) << "! Your bonus is " << employee1.getBonus(employee1.getyos(), employee1.getetype());
    }
    else
    {
        cout << "Enter your firstname: ";
        getline(cin, a);
        cout << "Enter your lastname: ";
        getline(cin, b);
        cout << "Enter your birthday: ";
        getline(cin, c);
        employee2.setbirthday(c);
        cout << "Enter your age: ";
        cin >> d;
        employee2.setage(d);
        cout << "Enter your age when you entered the company: ";
        cin >> e;
        employee2.setageCompany(e);
        cout << endl << "Hello, " << employee2.setfirstName(a) << " " << employee2.setlastName(b) << "! Your bonus is " << employee2.getBonus(employee2.getyos(), employee2.getetype());
    }
}

`

0 Answers0