Using an Array in a function!?!

I need help with this program. I need to use 3 different functions. The first function should read in N amount of integer values from the user.If any values are less than 1, store a value of 0 instead of the input value.
Second should go through the entire array to find the largest value and
send the largest value back to the main program.
The last is just an output function where I write out all of the array values and the largest value.

Here is the program. It is very rough but I just want feed back and I really want to learn how to do this properly so please give me feedback so I can learn this.

using namespace std;
#define ARRSIZE 20
void getData(int A[]);
void findBig(int A[ARRSIZE], int max)
int main()
{
int A;
int big;
getData(A,20);
findBig(A[ARRSIZE]);
}
void getData(int A[])
{
int A[ARRSIZE],num;
cout<<"Please enter 20 numbers greater than or equal to 1."<<endl;
for (int i=0; i<ARRSIZE;i++)
{
cin>>num;
A[i]=num;
while(num<1)
{
num==0;
A[i]=num;
}
}
}
void findBig(int A[], int max)
{
int i;
int max=A[i];
for(int i=0;i<ARRSIZE;i++)
{
if(A[i]>max)
max=A[i];
}
}
Last edited on
Please don't spam the forum with multiple threads for the same question.

Also, please use code tags when posting code, to make it more readable.
Sorry Im new to this. I didn't know where to post it
Topic archived. No new replies allowed.