I have been working on my code today and have minimalized my errors. Sadly, I still have a few errors left I can't figure out how to solve.

``28 F:\Program6-Arrays2.8.cpp cannot convert `double' to `double*' for argument `1' to `double getInput(double*, int)'``
``````#include<iostream>
#include<cmath>
#include<conio.h>
#include<iomanip> //needed for setw()

using namespace std;

// Function prototypes
double getInput(double[],int);
double getLow(double[],int);
double getHigh(double[],int);
double getsum(double[],int);

int main()
{
const int SIZE=8;
int num;
double numbers;
double sum;
double lowestscore;
double highestscore;
double scores[SIZE];
double array[0];

cout << setprecision(1) << fixed << showpoint;

sum= getInput(numbers,SIZE);

lowestscore = getLow (array,SIZE);

highestscore = getHigh (array,SIZE);

sum = getsum (array,SIZE);

sum -= lowestscore;

sum -= highestscore;

cout << "Contestant Receives: " << sum << endl;

cout << "Dropped Low Score: " << lowestscore << endl;

cout << "Dropped High Score: " << highestscore << endl;

return 0;

}

double getInput(double numbers[],int size)
{
int index;

for(index = 0; index <= size - 1;index++)
{

cout << "Enter Judges Score #" << (index+1) << ":";
cin >> numbers[index];
}
}

double getLow(double array[], int size)
{
double lowest;
int counter=1;
lowest = array[0];

for(int counter = 1; counter < size ; counter++)
{
if( array [counter] < lowest)
lowest = array [counter];

return lowest;
}

double getHigh( double array[] , int size);
{
double highest;

highest = array[0];
for(int counter = 1; counter < size ; counter++)
{
if(array [counter] > highest)
highest = array [counter];

return highest;
}

double getsum(double array[],int size);
{
double sum=0;
for(int count = 0 ;count < size ;count++)
sum += array [count];

return sum;
}
}
}``````

you have the function `double getInput(double[],int);` to accept a double array; however, in line #28 you are attempting to pass in a double var.

one solution could be to overload the getInput() function so you would have a version of the function that would accept a double, and one …

## All 4 Replies

you have the function `double getInput(double[],int);` to accept a double array; however, in line #28 you are attempting to pass in a double var.

one solution could be to overload the getInput() function so you would have a version of the function that would accept a double, and one version that would accept a double array.

you have the function `double getInput(double[],int);` to accept a double array; however, in line #28 you are attempting to pass in a double var.

one solution could be to overload the getInput() function so you would have a version of the function that would accept a double, and one version that would accept a double array.

Is it possible to convert a double variable into a double array?

you have the function `double getInput(double[],int);` to accept a double array; however, in line #28 you are attempting to pass in a double var.

one solution could be to overload the getInput() function so you would have a version of the function that would accept a double, and one version that would accept a double array.

How would I overload the getInput()function?

How would I overload the getInput()function?

You overload a function by making different versions of it. All the versions have the same name, they just differ in the parameters. For example:

``````int getInput(a[], int);
int getInput(int, int);
int getInput(double, float);``````

Then the compiler will automatically select the right version for what you are trying to do so that you don't have to worry about getting the parameters right (so long as you have a version to cover it).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.