Im trying to load up an array of struct variables. I get stuck in the loop in my function that loads that is supposed to load the structs into the array. I'll post my code, and any help that you guys could provide would really be appreciated.

I've just posted my load function, as my count function works fine, as does my menu, but I am leaving the struct in.
I've left the Couts & system pauses in there, they dont need to be there, I just put them in to help in the debuging. This program loods the first element from the text file perfectly, then all I get from ther is jiberash.
Thanks
Dave
Code:


struct emp
       {
            string name;
            int empid;
            char type;
            
            //h=hourly, s=salaried
            float payrate;
            string dept;
            string title;
            
            };



}
//*********************************load***********************************
//********************loads employees into an arrray
void load()//(int count)
{
    
    int tempi;
    tempi = empcount();
    emp E[tempi];
    
    fstream fin;
    fin.open("empdata.txt",ios::in);

 
for(int i=0; i<=tempi; i++)
 {
    getline (fin, E[i].name);
    cout<<E[i].name;
    fin.ignore();
    system("pause");
    
    fin>>E[i].empid;
    cout<<E[i].empid;
    system("pause");
   
    fin>>E[i].type;
    cout<<E[i].type;
    system("pause");
    
    fin>>E[i].payrate;
    cout<<E[i].payrate;
    system("pause");
    
    getline (fin, E[i].dept);
    cout<<E[i].dept;
    system("pause");
    
    getline (fin, E[i].title);
    cout<<E[i].title;
    system("pause");
 }

fin.close();


}
    

int main()
{
    int mcount;
    
    mcount = empcount();  // empcount is the name of my count  f               .   
    cout<<"There are "<<mcount<<" employees in the file.    <<endl;
    menu();
    load();
    
    
    system("pause");
    return 0;
};