In a C++ program, you need to store the identification numbers of 10 employees (
ID: 3583326 • 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 gross pay.Explanation / Answer
#include <iostream>
using namespace std;
int main(){
int id[10]={1,2,3,4,5,6,7,8,9,10};
int pay[10]={20000.00,20001.00,20002.00,20003.00,20004.00,20005.00,20006.00,20007.00,20008.00,20009.00};
for(int i=0;i<10;i++){
cout << id[i] << "-" <<pay[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.