Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

2. Define a struct worker which has two properties: id and wage . id is in integ

ID: 3615382 • Letter: 2

Question

2. Define a struct workerwhich has two properties: idand wage. id is in integertype,

and wage is in double type. Create an array with 6 elementsusing worker in main(),

and assign the 6 workers’ ids from 1 to 6, and assignthe 6 workers’ wage from 1100 to

1600; then define a new function and pass the worker arrayto it. In the function, you

will double the workers’ wage. Finally, in main(),output the workers’ new wage results.

Note: it’s required to modifythe workers’ wage in a new functionother than main().

The following specifications will be expected for each ofyour projects for this class:

hardcopy.

Date Due: Monday, Nov. 30,2009

Explanation / Answer

#include<iostream.h> #include<conio.h> struct worker {    int id;    double wages; } void wagescal(worker); void main() {    clrscr(); worker array[6]; array[0].id=1; array[0].wages=1100.00; array[1].id=2; array[1].wages=1200.00; array[2].id=3; array[2].wages=1300.00; array[3].id=4; array[3].wages=1300.00; array[4].id=5; array[4].wages=1400.00; array[5].id=6; array[6].wages=1500.00; wagescal(array); for(int i=0;i<6;i++) {    cout<<"ID="<<array[i].id; cout<<" Wages="<<array[i].wages; } getch(); } void wagescal(worker add) { for(int i=0;i<6;i++) {    add[i].wages=add[i].wages*2; } } Hope it will help you. array[2].wages=1300.00; array[3].id=4; array[3].wages=1300.00; array[4].id=5; array[4].wages=1400.00; array[5].id=6; array[6].wages=1500.00; wagescal(array); for(int i=0;i<6;i++) {    cout<<"ID="<<array[i].id; cout<<" Wages="<<array[i].wages; } getch(); } void wagescal(worker add) { for(int i=0;i<6;i++) {    add[i].wages=add[i].wages*2; } } Hope it will help you. array[4].id=5; array[4].wages=1400.00; array[5].id=6; array[6].wages=1500.00; wagescal(array); for(int i=0;i<6;i++) {    cout<<"ID="<<array[i].id; cout<<" Wages="<<array[i].wages; } getch(); } void wagescal(worker add) { for(int i=0;i<6;i++) {    add[i].wages=add[i].wages*2; } } Hope it will help you.
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote