hi, this is the problem, i wrote what i could but i dont know what im doing wrong
1. Write a function to read in numbers and put them into the array. The function should continue to read in numbers until either: the user types a negative number, or 5 numbers (hint: MAXSIZE) have been read. The function should also return the number of elements in the array. Write comments before the function that describe what the function does, what it needs passed to it, what it sends back to the function call, and how it accomplishes its task.
2 Then write a second function that will accept an array and print out the contents of the array. This function should accept an array and the number of elements that are to be printed. Before writing the code for this function, write the comments.
this is what i have so far
#include <iostream>
using namespace std;
int Function1(double []);
void PrintArray(const double [], int);
const int MAXSIZE =5;
int main()
{
double array1[5];
int count;
count = Function1(array1);
cout<<"There were "<<count<<" numbers entered into the array."<<endl;
PrintArray(array1, 5);//function call to function that will print the array
return 0;
}
//Write the function here to read in numbers into the array. The array is called myarray.
//add comments describing what this function does, what is passed to it, what it sends back, etc.
int Function1(double myarray[])
{
cout<<"Please enter the number"<<endl;
int count = 0, next;
while (myarray>=0)
{cin>>next;
myarray[count]=next;
}
return 0;
}
//Write the new function here along with comments
//add comments describing what this function does, what is passed to it, what it sends back, etc.
void PrintArray(const double a1[], int size)
{
for (int x = 0; x < 5; x++ )
{
cout << a1[ x ] << endl;
}
system("pause");
}