Visual C++ assistance

I need to modfiy this program so that it allows the user to enter the number of yrs for as many employees as desired, calculate and display the total number of employees.
can someone assist me with this....I know it needs a while loop and a sentinel, but I am having a hard time writing it.


cout << "Enter the years employed: ";
cin >> years;

//display vacation weeks
while years<0;
{
if (years == 0)
cout << "Vacation weeks: 0" << endl;
else if (years <= 5)
cout << "Vacation weeks: 1" << endl;
else if (years <= 10)
cout << "Vacation weeks: 2" << endl;
else cout << "Vacation weeks: 3" << endl;
//end ifs
Try something like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
unsigned int total_employees, vacation0, vacation1, vacation2, vacation3;
int years;

while(years >= 0) {
     cout<<"Enter a negative number to exit"<<endl<<"Enter the years employed: ";
     cin>>years;
     if(years == 0) { //you can add the couts if you want
          vacation0++;
     } else if(years <= 5 && years > 0) {
          vacation1++;
     } else if(years <= 10 && years > 5) {
          vacation2++;
     } else if(years > 10) {
          vacation3++;
     }
     total_employees++;
}

cout<<"Total Employees: "<<total_employees<<endl
    <<"Employees with no vacation weeks: "<<vacation0<<endl
    <<"Employees with 1 vacation week: "<<vacation1<<endl
    <<"Employees with 2 vacation weeks: "<<vacation2<<endl
    <<"Employees with 3 vacation weeks: "<<vacation3<<endl;
    //... 
Thank you Very much.
Topic archived. No new replies allowed.