i have written the following code. the problem is when i run (F9), i dont see my output neither do i see any error in the program. any idea why? thx in advance.

empId: an array of seven long integers to hold employee identification numbers.
hours: an array of seven integers to hold the number of hours worked
by each employee
payRate: an array of seven floats to hold each employee's hourly pay rate
wages: an array of seven floats to hold each employee's gross wages.
The program should relate the data in each array through the subscripts. For
example, the number in element 0 of the 'hours' array should be the number of
hours worked by the employee whose identification number is stored in element 0
of the 'empId' array. That same employee's pay rate should be stored in element
0 of the payRate array.

The program should display each employee number and ask the user to enter that
employee's hours and pay rate. It should then calculate the gross wages for that
employee (hours times pay rate), which should be stored in the 'wages' array.
After the data has been entered for all the employees, the program should
display each employee's identification number and gross wages.

#include <cstdlib>
#include <iostream>
#include <iomanip>
using namespace std;

int main(int argc, char *argv[])
{
    const int size = 7;                                                                  
    long empID[size] = {5658845, 4520125, 7895122,         
                8777541, 8451277, 7302850, 7580489};
    int hours[size];      
    float payRate[size];                                  
    float wages[size];
    
//Function Prototypes
float getWages(float);
float displayWages(float);


cout<<"Enter the info for each of the following employees "<<endl;
cout<<"identified by their ID numbers: "<<endl;
getWages(1);
displayWages(1);


//_________________________________________________________________________________________
//Input hours worked


float getWages(float size, int hours, float payRate, float empID);
{
for (int index = 0; index < size; index++)

{
    cout<<" "<<endl;
    cout<<"Employee number: "<<empID[index]<<endl;
    cout<<"Number of hours worked: ";
    cin>>hours[index];
    //eliminate negative numbers
    while (hours[index] < 0)
    {
          cout<<"Employee can not work negative hours"<<endl;
          cout<<"Number of hours worked: ";
          cin>>hours[index];
    }    
    cout<<"Pay Rate: ";
    cin>>payRate[index];
}
}
//____________________________________________________________________________
//Display the hours worked and the employees number


float displayWages(float wages, float size, int hours, float Payrate, float empID);
cout<<"\n\n"<<endl;
cout<<"Employee Number          Wages    "<<endl;
cout<<"__________________________________"<<endl;
cout<< fixed << showpoint << setprecision(2);

for (int index = 0; index <size; index++)
{
    double wages = hours[index] * payRate[index];
    cout<<"   "<<empID[index]<<"              $ "<<wages<<endl;
}




cin.ignore(-1u); // clears EVERYTHING out of cin
cin.clear(); // resets cin so the next line will work
cin.get(); // wait for a character to be pressed



 //   system("PAUSE");
 //   return EXIT_SUCCESS;
}
Salem commented: 25 posts, and you still haven't figured out code tags -2

Recommended Answers

All 4 Replies

Read this before you ever think about posting more code.

Do you think the mods have nothing better to do all day than clear up after you?
Examples:
Last edited by stymiee : 1 Day Ago at 18:02. Reason: added code tags
Last edited by Ancient Dragon : 8 Days Ago at 04:54. Reason: add code tags

Also, you've started 5 threads with the same title, a rather unimaginative "help".
http://catb.org/~esr/faqs/smart-questions.html#bespecific

For 25 posts, you sure haven't been listening to posting suggestions.

READ THE FAQ!!!! Titles are important
READ THE "READ THIS BEFORE YOU POST" STICKY!!! How you ask helps how you are helped
READ THE BBCODE STICKY!!! READ THE BACKGROUND ON THE BOX YOU TYPE YOUR MESSAGES IN!!!! How you post helps us help you

ok, i understand! i will try my best from nowon to follow the exact rules on this site. if you are not going to help with this problem, i am perfectly fine. i once again apologize for not following rules. I am sorry

>>the problem is when i run (F9),
That doesn't mean a thing to anyone here because you didn't say what compiler you are using. The F9 key could do anything including display some porn film :)

Next problem is that the code you posted won't compile without errors. Clean it up before attempting to run it (I guess that's what F9 is supposed to do). Notice that getWages is coded inside main(), which is always illegal to do.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.