Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am creating a simple payroll program on Dev C++ 4.9.9.2. I\'m trying to get th

ID: 3622309 • Letter: I

Question

I am creating a simple payroll program on Dev C++ 4.9.9.2. I'm trying to get the program to have multiple employee IDs and I thought I created it right, but when I compile and run the program flashes and goes away. How can I get the program to stay on the screen or fix the loop?

This is the program that I have written up so far.

#include <iostream>
using namespace std;

int main(){
    int numberofemployees;
    int employeeid, hoursworked;
    float hourlyrate, grosspay, taxamount, netpay;
    const float TAXRATE = 0.20;
    while(numberofemployees=0){
       cout <<"ENTER NUMBER OF EMPLOYEES:";
       cin >>numberofemployees;
       cout <<"ENTER THE EMPLOYEE ID:";
       cin >>employeeid;
       cout <<"ENTER THE HOURS WORKED:";
       cin >>hoursworked;
       cout <<"ENTER THE HOURLY RATE:";
       cin >>hourlyrate;
       grosspay=hoursworked*hourlyrate;
       taxamount=grosspay*TAXRATE;
       netpay=grosspay-taxamount;
       cout <<"EMPLOYEE ID IS "<<employeeid<<std::endl;
       cout <<"YOUR HOURS WORKED ARE "<<hoursworked<<std::endl;
       cout <<"YOUR HOURLY RATE IS "<<hourlyrate<<std::endl;
       cout <<"YOUR TAX AMOUNT IS "<<taxamount<<std::endl;
       cout <<"YOUR GROSSPAY IS "<<grosspay<<std::endl;
       cout <<"YOUR NETPAY IS "<<netpay<<std::endl;
       numberofemployees = numberofemployees + 1;
       system("pause");
       }//WHILE
       return 0;
}//MAIN

Explanation / Answer

#include
using namespace std;
int main(){
int numberofemployees=1;
int employeeid, hoursworked;
float hourlyrate, grosspay, taxamount, netpay;
const float TAXRATE = 0.20;
cout <<"ENTER NUMBER OF EMPLOYEES:";
cin >>numberofemployees;
while(numberofemployees!=0){

cout <<"ENTER THE EMPLOYEE ID:";
cin >>employeeid;
cout <<"ENTER THE HOURS WORKED:";
cin >>hoursworked;
cout <<"ENTER THE HOURLY RATE:";
cin >>hourlyrate;
grosspay=hoursworked*hourlyrate;
taxamount=grosspay*TAXRATE;
netpay=grosspay-taxamount;
cout <<"EMPLOYEE ID IS "< cout <<"YOUR HOURS WORKED ARE "< cout <<"YOUR HOURLY RATE IS "< cout <<"YOUR TAX AMOUNT IS "< cout <<"YOUR GROSSPAY IS "< cout <<"YOUR NETPAY IS "< numberofemployees = numberofemployees - 1;
system("pause");
}//WHILE
return 0;
}//MAIN