#include <iostream>
#include <iomanip>
usingnamespace std;
int main()
{
int numberOfEmp;
int count = 1;
char empid[100][12];
char fname[100][14], lastname[100][15];
int hw[100];
double gp[100], hr[100], taxrate[100], taxamt[100];
double np[100];
int counter = 0;
int i;
/*All of this code in the next few lines
are just an example of I\O manipulor There are more used in later code */
//**************************************************
cout.setf(ios::right,ios::adjustfield);
cout<<setw(40)<< "Welcome!" <<"\n\n";
cout.setf(ios::right, ios::adjustfield);
cout<<" "<<setw(49)<<setfill('*')<<" ACME EBRAHIMI'S PAYROLL INSTITUE ";
cout.setf(ios::right,ios::adjustfield);
cout<<setw(50)<<setfill('*');
cout<<"\n\n Thank you for chosing this program\n";
cout<<"\nPress enter to continue.....";
cin.get();
//************************************************
cout.unsetf(ios::right);
cout<<setfill(' ')<< setw(count); // all of this code here is just to undo the Setfill('*')
// so that thie * doesn't show in our output, at the end of our display.
cout<<("\nThe number of Employees: ");
cin>>numberOfEmp;
// this here is the start of the main program
while((((((((((counter<numberOfEmp)&&(cout<<"Enter EMP ID")&&(cin>>empid[counter])&&(cout<<"Enter First Name")&&(cin>>fname[counter])&&(cout<<"Enter Last name")&&(cin>>lastname[counter])&&(cout<<"Enter Hours worked")&&(cin>>hw[counter])&&(cout<<"Enter the Hourly Rate")&&(cin>>hr[counter]))))))))))
counter=counter+1;
for(i=0;i<counter;i++){
gp[i]=hw[i]*hr[i];
if(gp[i]>500)taxrate[i]=.20;
else taxrate[i]+.10;
taxamt[i]=gp[i]*taxrate[i];
np[i] = gp[i] - taxamt[i];
}//end of netpay for loop
cout <<endl;
cout<<setw(15)<<"EMPLOYEE ID"<<setw(16)<<"FIRST NAME"<<setw(17)
<<"LASTNAME" <<setw(4) <<"HW"<<setw(5)<<"HR"<<setw(6)
<<"GROSS"<<setw(6)<<"TAX"<<setw(9)<<"NETPAY"<<endl<<endl;
for(i=0;i<counter;i++){
cin.get();
// the code setw is used for padding and to get the display to look right.
cout<<setw(15)<<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;
}// end of this for loop
cout<<"Press any button to finish";
cin.get();
return 0;
}
Now here is the Question.
EX6.Sort the net pays (salary) using an array of pointers (do not change the data in the original array). For now, display only the net pays before sorting Sort the net pays (salary) using an array of pointers (do not change the data in the original array). For now, display only the net pays before sorting and after sorting.
HOW in heck do you Sort salaries by using pointers... This doesn't make sense to me.
As I don't want to give you any incorrect answers or lead you astray, I can only suggest readin up on the sort in algorithm header. and/or implementing your own sort. http://www.cplusplus.com/reference/algorithm/sort/
It really doesn't matter who posts the question. We both have the same question.
However, she has a few different set of people to talk to, while I have my different sets of resources to count for...
Beside all of that I have more time to post this kind of information, and I'm her tutor, she is the student.
Gcampton! Thanks for the information, that will come in handy later on... I think I know what I have to do, to make this program work.. I will post the finish source code later...
INDENT THAT code. It is already in code tags which is appreciated but the indents are necessary to see the scope.
And yeah try the algos header. It works well and you can use it on arrays.