Question: I have this code to execute a payroll program and everytime i put it into dec c++ or codeblocks the out put looks like this:
I have this code to execute a payroll program and everytime i put it into dec c++ or codeblocks the out put looks like this:
please help me figure out whats wrong here

#include
using namespace std;
//calculating pay double calcpay(double rate, int hours){ double totalPay = 0; if(hours>40){ //if overtimr duty dine totalPay = 40 * rate; totalPay = totalPay + (hours-40)*rate*1.5; } else{ //if not over time. just normal pay totalPay = hours * rate; } return totalPay; } int main() { std::ifstream readfile("employees.txt");//reding employees data from text file std::string eachline; int count=0; double payRoll = 0;
while (std::getline(readfile, eachline)) { std::istringstream iss(eachline); string name; double rate; int hours; while (iss >> name >> rate >> hours)//reading line data from file { double pay = calcpay(rate,hours); //prinitng each employee details cout
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
