View Single Post
Old Apr 8th, 2006, 10:59 PM   #18
jayme
Professional Programmer
 
jayme's Avatar
 
Join Date: Nov 2005
Location: Canada
Posts: 495
Rep Power: 0 jayme is an unknown quantity at this point
Send a message via MSN to jayme
You are trying to create an object of the same name everything the loop loops through.

Employee emp(id, sex, wage, years)[i+1];//Creates an object. Don't do this inside a loop.

do something like this:

Employee emp(id, sex, wage, years)[10]; // There is 10 employees
    for(i=0; i<10; i++)
    {
             cout << "Please enter the following Employess information:" << endl;
             cout << "\nEmployee ID No: ";
             cin >> id;
             cout << "\nEmployee Sex: ";
             cin >> sex;
             cout << "\nEmployee Wage: ";
             cin >> wage;
             cout << "\nYears with Company: ";
             cin >> years;
             emp[i].makeString();
    }

EDIT: Actually, you have a constructor to basically zero out all the values. Why do you have Employee emp(id, sex, wage, years)?
__________________

Quote:
Originally Posted by Mohamed Jihad
Durka durka!
Due to incorrect calculations during the middle ages, our calendar actually begins a few years after Jesus' birth. Thus the real 6/6/6 happened a few years back. The world already ended and you missed it.

Download Code::Blocks now!
jayme is offline   Reply With Quote