HI all,
First of all:
I was reading about constant arrays in a book and I didn't really get the idea behind it's use or how it functions though I do understand that the values of the array items is not going to change .. help clarify this issue please ..
Secondly:
I have to do a program but through steps and I try my code after each step
Well I've done two functions one to read the values of salaries and the other is to find the maximum value. However, I have got two error saying :
error C2664: 'read_salary' : cannot convert parameter 1 from 'double [5]' to 'double'
and
error C2664: 'max_salary' : cannot convert parameter 1 from 'double [5]' to 'double'
it's basically the same problem in both errors, I know that it has to do with some assignment of variables or something like that as I have already googled the type of error but have not succeeded to fix the error
this is my code : (note:please help so I can keep moving to build the other parts of my program )
# include <iostream>
using namespace std;
void read_salary(double , int);
int max_salary(double, int);
int main()
{
int looper;
int max;
double salary[5];
read_salary(salary,looper);
max_salary(salary, looper);
cout << "The max" << max;
return 0;
}
void read_salary(double salary[], int looper)
{
for (looper=0; looper<5; looper++)
{
cout << "Please enter employee #"
<< looper <<"'s salary" <<endl;
cin >> salary[looper];
}
}
double max_salary(double salary[], int looper)
{
int max_index =0;
for (looper=1; looper<5; looper++)
if (salary[max_index] < salary[looper] )
{
max_index=looper;
}
return max_index;
}
Your help is highly appreciated and your explaining is of more value.