219k views
5 votes
In a program, you need to store the identification numbers of 10 employees (as integers) and their weekly gross pay (as double values). Define two arrays that may be used in parallel to store the 10 employee identification numbers and gross pay amounts Write a loop that uses these arrays to print each of the employees’ identification number and weekly gross pay.

User Furqi
by
8.8k points

1 Answer

6 votes

Answer:

The code to the given question can be given as:

Code:

1)

2 arrays that used to store 10 employee identification number and grosspay amount in parallel and its data-type is int and double.

int Employee_id[10]; //array that store integer value

double Weekly_Gross_Pay[10]; //array that store double value

2)

Define loop for print the details of employees’ identification number and weekly gross pay.

for(int i=0; i<10; i++)

{

cout <<Employee_id[i] <<" " << Weekly_Gross_Pay[i] << endl;

}

Explanation:

The explanation of the above code can be given as:

In Code (1) we declare two array that's data-type is integer and double. In Employee_id array it store the integer values and Weekly_Gross_Pay it store the double value.

In Code(2) It is used to print the value of array. In that code, we used for a loop because of its entry control loop and we know the size of the array. In this loop, we declare a variable (i) and initialized the value 0 and check the condition(i)less than 1 and increment of i. It prints all the 10 values.

User Christlin Panneer
by
8.7k points