In a C++ program you need to store the identification numbers of 10 employees (a
ID: 3582704 • Letter: I
Question
In a C++ program you need to store the identification numbers of 10 employees (as ints) and their weekly gross pay (as doubles). Write the statements (not the complete program) that define two arrays named id and pay that may be used in parallel to store the 10 employee identification numbers and gross pay amounts. Assume the employee identification numbers and gross pay amounts have already been entered into the above two arrays. Write a loop (not the complete program) that uses these two arrays to output each employee's identification number and weekly pay.Explanation / Answer
int empIDs[10]; //Declares an array of 10 employees of type int.
double weeklyPay[10]; //Declares an array of 10 payments of type double.
for(int i = 0; i < 10; i++) //For each of the 10 employees.
cout<<empID[i]<<" has a weekly pay of "<<fixed<<setprecision(2)<<weeklyPay[i]<<endl;
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.