Hello, I am trying to get this Array to show the summary of NETPAY but have been failing. What is wrong?
#include <iostream>
#include <iomanip>
using namespace std;
main(){
char empid[ 100 ][ 12 ];
char fname[ 100 ][ 14 ], lastname[ 100 ][ 15 ];
int sum;
int hw[ 100 ];
double gp[ 100 ], np[ 100 ], hr[ 100 ], taxrate[100], taxamt[ 100
];
int counter = 0;
int i;
cout<<"ENTER EMP ID, FNAME, LNAME, HRS WORKED, HRLY RATE ctrl
z to end"<<endl;
while(
cin>>empid[counter]>>fname[counter]>>lastname[counter]>>hw[counter]>>
hr[counter])
counter=counter+1;
for ( i=0; i<counter; i++){
gp[i] = hw[i] * hr[i];}//end grosspay for loop
for (i=0; i<counter; i++){
if (gp[i]>500) taxrate[i] = .30;
else if (gp[i]>200) taxrate[i]=.20;
else taxrate[i] = .10;
}// FOR
for ( i=0; i<counter; i++){
taxamt[i] = gp[i] * taxrate[i];}//end taxamount for loop
for ( i=0; i<counter; i++){
np[i] = gp[i] - taxamt[i];}//end netpay for loop
cout<<endl;
cout<<setw(14)<<"EMPLOYEE
ID"<<setw(16)<<"FIRST NAME"<<setw(17)
<<"LAST NAME"
<<setw(4)<<"HW"<<setw(5)<<"HR"<<setw(6)
<<"GROSS"<<setw(6)<<"TAX"<<setw(9)<<"NET
PAY"<<endl<<endl;
for (i=0; i<counter;
i++){
cout<<setw(14)<<empid[i]<<setw(16)<<fname[i]<<setw(17)<<lastname[i]<<setw(4)
<<hw[i]<<setw(5)<<hr[i]<<setw(6)<<gp[i]<<setw(6)<<taxamt[i]<<setw(9)<<np[i]<<endl;
}// FOR
return 0;
}//MAIN
If you have any doubts, please give me comment...
If you press Ctrl+z, the program will suspended, Ctrl+d, the program will be execute perfect...

Code:
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
char empid[100][12];
char fname[100][14], lastname[100][15];
int sum;
int hw[100];
double gp[100], np[100], hr[100], taxrate[100], taxamt[100];
int counter = 0;
int i;
cout << "ENTER EMP ID, FNAME, LNAME, HRS WORKED, HRLY RATE ctrl d to end"<< endl;
while (cin >> empid[counter] >> fname[counter] >> lastname[counter] >>
hw[counter] >> hr[counter])
counter = counter + 1;
for (i = 0; i < counter; i++) {
gp[i] = hw[i] * hr[i];
} // end grosspay for loop
for (i = 0; i < counter; i++) {
if (gp[i] > 500)
taxrate[i] = .30;
else if (gp[i] > 200)
taxrate[i] = .20;
else
taxrate[i] = .10;
} // FOR
for (i = 0; i < counter; i++) {
taxamt[i] = gp[i] * taxrate[i];
} // end taxamount for loop
for (i = 0; i < counter; i++) {
np[i] = gp[i] - taxamt[i];
} // end netpay for loop
cout << endl;
cout << setw(14) << "EMPLOYEE ID" << setw(16) << "FIRST NAME" << setw(17)
<< "LAST NAME" << setw(4) << "HW" << setw(5) << "HR" << setw(6)
<< "GROSS" << setw(6) << "TAX" << setw(9) << "NET PAY" << endl
<< endl;
for (i = 0; i < counter; i++) {
cout << setw(14) << empid[i] << setw(16) << fname[i] << setw(17)
<< lastname[i] << setw(4) << hw[i] << setw(5) << hr[i] << setw(6)
<< gp[i] << setw(6) << taxamt[i] << setw(9) << np[i] << endl;
} // FOR
return 0;
} // MAIN
Hello, I am trying to get this Array to show the summary of NETPAY but have...
This is C++. The task is to convert the program to make use of fucntions, but I am am struggling to figure out how to do so. #include <iostream> #include <iomanip> using namespace std; main(){ char empid[ 100 ][ 12 ]; char fname[ 100 ][ 14 ], lastname[ 100 ][ 15 ]; int hw[ 100 ]; double gp[ 100 ], np[ 100 ], hr[ 100 ], taxrate[100], taxamt[ 100 ]; int counter = 0; int i; cout<<"ENTER EMP ID,...
Expand the payroll program to combine two sorting techniques
(Selection and Exchange sorts) for better efficiency in sorting the
employee’s net pay.
//I need to use an EXSEL sort in order to
combine the selection and Exchange sorts for my program. I
currently have a selection sort in there. Please help me with
replacing this with the EXSEL sort.
//My input files:
//My current code with the sel sort. Please help me replace this
with an EXSEL sort.
#include <fstream>...
Hello I need a small fix in my program. I need to display the youngest student and the average age of all of the students. It is not working Thanks. #include <iostream> #include <iomanip> #include <fstream> #include <vector> #include <algorithm> using namespace std; struct Student { string firstName; char middleName; string lastName; char collegeCode; int locCode; int seqCode; int age; }; struct sort_by_age { inline bool operator() (const Student& s1, const Student& s2) { return (s1.age < s2.age); // sort...
Hello, I need to implement these small things in my C++ code. Thanks. 1- 10 characters student first name, 10 characters middle name, 20 characters last name, 9 characters student ID, 3 characters age, in years (3 digits) 2- Open the input file. Check for successful open. If the open failed, display an error message and return with value 1. 3- Use a pointer array to manage all the created student variables.Assume that there will not be more than 99...
I am trying to modify this program so that it stores the employee's name in a c-string and can handle up to 100 employees (so it would mostly be a partially filled array), but I cannot get it to work. It works with two files that it is suppose to read input from. Then it prints output to an output file. Employee Info File (first file read, M/F should be ignored): 5 Christine Kim 30.00 2 1 F 15 Ray...
Hi, I am trying to convert a string vector to a double vector in c++ , but for some reason I am getting this error message. Hope you can help! Thanks error: cannot convert ‘std::string {aka std::basic_string<char>}’ to ‘const char*’ for argument ‘1’ to ‘double atof(const char*)’ double salary = atof(info[x].stringsalary); my code is... void display(vector<Employee_Data>& info){ double total = 0; cout << "id" <<setw(25) <<"first name" <<setw(25) <<"last name" <<setw(25) <<"gender" <<setw(25) <<"department" <<setw(25) <<"salary" << endl ; for(int...
The following C++ code include 3 files: Patient.h, Patient.cpp and Main.cpp. The program basically creates and stores patient records. The original code has everything in a single .cpp file. I tried to divide the code in 3 parts (Patient.h, Patient.cpp and Main.cpp), but it is giving me errors. Patient.h #ifndef PATIENT_H #define PATIENT_H #include <string> #include "Patient.cpp" using namespace std; class Patient{ private : string firstname; string lastname; string location; static int cnt; int id; public : Patient(string, string, string);...
I am trying to write a c++ program that will add two binary numbers that are entered into the command line. I cannot get the program to send anything to stdout. code attached. int main(int argc, char *argv[]) // IN IN { char partialSum[MAX_DIGITS + 1]; //partial sum of the binary numbers char sum[MAX_DIGITS + 1]; //sum of the binary numbers bool noError; //no error flag //Exit if insufficient arguments...
Hello, I am working on a project for my C++ class, I have the vast majority of the code figured out but am running into a few issues. Mainly updating each * to an X. The problem is as follows:(Airplane Seating Assignment) Write a program that can be used to assign seats for a commercial airplane. The airplane has 13 rows, with six seats in each row. Rows 1 and 2 are first class, rows 3 through 7 are business...
Hello, I am working on my final and I am stuck right near the end of the the program. I am making a Tic-Tac-Toe game and I can't seem to figure out how to make the program ask if you would like to play again, and keep the same names for the players that just played, keep track of the player that wins, and display the number of wins said player has, after accepting to keep playing. I am wanting...