issue with c++ code skipping get line statement
<p>Hey guys i am having an issue with an assignment I am working on.</p>

<p>The code is as follows:</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;iomanip&gt;
#include &lt;cmath&gt;
#include &lt;cstdio&gt;
#include &lt;cstring&gt;

using namespace std;

class payroll
{
private:
    char empnum[10];
    char empfirstname[150];
    char emplastname[150];
    char empsin[9];
    char empdob[10];
    char empphone [15];
    char empstreet[100];
    char empcity[60];
    char empprovince[150];
    char empcountry[200];
    char empstatus[50];       //Employee status. EX: Terminated, On leave, Active etc.
    int empsalaryei;
    int empsalaryfedtax;
    int empsalarycpp;
    int empsalarynet;
    int empsalarygross;

public: 
    void addrec(void);
    void modrec(void);
    void viewrec(void);
    void exit(void);
};

payroll rec;
payroll emp;
ifstream inFile1;
ifstream inFile2;
bool check = false;

int main()
{
    system("CLS");
    char ch;

    do
    {
        cout&lt;&lt;"1. Add an employee\n";
        cout&lt;&lt;"2. Modify employee record\n";
        cout&lt;&lt;"3. View employee record\n";
        cout&lt;&lt;"0. Exit\n";
        cout&lt;&lt;"Please choose an item: ";
        if (check == true)
        {
            system("CLS");
            ch=0;
        }
        else
            cin&gt;&gt;ch;

        switch(ch)
        {
            case '1':
                emp.addrec();
                break;

            case '2':
                emp.modrec();
                break;

            case '3':
                emp.viewrec();
                break;

            case '0':
                emp.exit();
                return 0;
        }
    }while(ch !=0);

    return 0;

}

void open_employee_info()               //function to open employee data file
{
    string filename1 = "employee-details.dat";        //define which file to open 

    inFile1.open(filename1.c_str());  //open our payroll file
    if(inFile1.fail())                                                       //if our file open fails....
    {
        cout &lt;&lt; "\nSorry the file was not opened successfully"&lt;&lt; "\n Please check that the file does exist or create it" &lt;&lt; endl;
        exit(1);
    }
    cout &lt;&lt; "\n The file was opened successfully" &lt;&lt; endl;
}

void open_payroll_info()               //function to open payroll salary information file
{
    string filename2 = "payroll-info.dat";          //define file name

    inFile2.open(filename2.c_str());
    if(inFile2.fail())
    {
        cout &lt;&lt; "\nSorry the file was not opened successfully"&lt;&lt; "\n Please check that the file does exist or create it" &lt;&lt; endl;
        exit(1);
    }
    cout &lt;&lt; "\n The file was opened successfully" &lt;&lt; endl;
}

void payroll::addrec(void)          //Record adding
{
    char userinputadd = ' ';

    cout &lt;&lt; "\nPlease Enter the Employee number: ";
    gets(rec.empnum);
    cout &lt;&lt; "\nPlease Enter the Employee's First Name: ";
    gets(rec.empfirstname);
    cout &lt;&lt; "\nPlease Enter the Employee's Last Name: ";
    gets(rec.emplastname);
    cout &lt;&lt; "\nPlease Enter the Employee's Date of Birth (mmddyyyy): ";
    gets(rec.empdob);
    cout &lt;&lt; "\nPlease Enter the Employee's Social Insurance Number: ";
    gets(rec.empsin);
    cout &lt;&lt; "\nPlease Enter the Employee's Phone Number: ";
    gets(rec.empphone);
    cout &lt;&lt; "\nPlease Enter the Employee's Address: ";
    gets(rec.empstreet);
    cout &lt;&lt; "\nPlease Enter the Employee's City: ";
    gets(rec.empcity);
    cout &lt;&lt; "\nPlease Enter the Employee's Province: ";
    gets(rec.empprovince);
    cout &lt;&lt; "\nPlease Enter the Employee's Country: ";
    gets(rec.empcountry);
    cout&lt;&lt;"\nPlease Enter the Employee's Status: ";
    gets(rec.empstatus);
    cout &lt;&lt; "\nPlease Enter the Employee's Weekly Gross Salary: ";
    cin &gt;&gt; rec.empsalarygross;

    cout&lt;&lt;"Would you like to return to the main menu?(y), else the program will exit: ";
    cin&gt;&gt;userinputadd;
    if (userinputadd =='y' || userinputadd =='Y')
        main();
    else
        exit();
}

void payroll::modrec(void)          //Record Modification
{
    system("CLS");
    int empmodnum=0;
    check = false;
    char userinputmod = ' ';

    cout&lt;&lt;"\nEnter the employee number for the record you would like to modify: ";
    cin&gt;&gt;empmodnum;

    cout&lt;&lt;"Would you like to return to the main menu?(y), else the program will exit: ";
    cin&gt;&gt;userinputmod;
    if (userinputmod =='y' || userinputmod =='Y')
        main();
    else
        exit();
}

void payroll::viewrec(void)         //Record viewing
{
    system("CLS");
    check = false;
    char userinputview = ' ';

    cout&lt;&lt;"Would you like to return to the main menu?(y), else the program will exit: ";
    cin&gt;&gt;userinputview;
    if (userinputview =='y' || userinputview =='Y')
        main();
    else
        exit();

}

void payroll::exit(void)
{
    inFile1.close();
    inFile2.close();
    check = true;
}
</code></pre>

<p>So on the front menu if you hit 1 to add a record you will see it skips the first cin statement being employee number.</p>

<p>Does anyone have an idea why this would occur?</p>
