I am new at c++ programming. In the code below, i wanted the user to enter the number of employees and the amount of sales for each employee. Then the program will write the corresponding amounts of sales for each employee.Although the compiler didn't give errors, it didn't work. Can you help me to find where the error is? Thanks in advance.
#include <iostream>
using namespace std;
int enterSales(int max){
int sales[max];
for (int idx=0;idx<max;idx++){
cout<<"Enter the amount of sales for person #"<<idx<<": ";
cin>>sales[idx];
}
return sales[max];
}
float showSalesComm(int max){
int sales[]={enterSales(max)};
for (int idx=0;idx<max;idx++){
cout<<"The amount of sales for person #"<<idx<<": ";
cout<<sales[idx]<<endl;
}
return 0;
}
int main () {
int max;
cout<<"Enter the number of employees.";
cin>>max;
showSalesComm(max);
return 0;
}