Question
Hello, please help me solve this, I don't know what is wrong with my code. Loop processing with arrays Keeping count of array elements that
Hello, please help me solve this, I don't know what is wrong with my code.
Loop processing with arrays
Keeping count of array elements that are being used
Parallel Arrays: Two or more arrays whose corresponding elements
refer to related information.
#include
#include
using namespace std;
//------------------------------------------------------------------------------
int main()
{
const int MAX_EMP = 5;
int employeeIds[MAX_EMP] = { 1001, 2034, 5529, 7661, 8999 };
double employeeWages[MAX_EMP];
char response;
int count=0;
do {
cout<<"Enter wages for employee "< cin>>employeewages[MAX_EMP]; count++; if(count { cout<<"Another (y or n): "; cin>>response; response= toupper(response); } } while(response=='Y'&& count cout< cout<<"IDWage"< double total=0.0; double indexOfSmallest=0; for(int k=0; count; k++) { cout <<"Average Wage: "<<(total/count)< cout<<"Largest wage found is $"< cout<<"Smallest wage found for employee"< } cout << " End Program - "; return 0; } //------------------------------------------------------------ /*Sample Program Output with exactly MAX_EMP wages... -------------------------------------------------------------- Enter wages for employee 1001: 10 Another (y or n): y Enter wages for employee 2034: 20.50 Another (y or n): y Enter wages for employee 5529: 15.25 Another (y or n): y Enter wages for employee 7661: 9.95 Another (y or n): y Enter wages for employee 8999: 24.10 IDWage 1001: $ 10.00 2034: $ 20.50 5529: $ 15.25 7661: $9.95 8999: $ 24.10 Average Wage: $15.96 Largest wage found is $24.10 Smallest wage found is for employee 7661: $9.95 End Program - Press any key to continue . . . =============================================================== Sample Program Output with fewer than MAX_EMP wages... =============================================================== Enter wages for employee 1001: 20.50 Another (y or n): y Enter wages for employee 2034: 10 Another (y or n): y Enter wages for employee 5529: 15.55 Another (y or n): n IDWage 1001: $ 20.50 2034: $ 10.00 5529: $ 15.55 Average Wage: $15.35 Largest wage found is $20.50 Smallest wage found is for employee 2034: $10.00 End Program - Press any key to continue . . . */
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started