this code is an exercise in array
int L;
int P=0;
int N=0;
int zero=0;
cout<<"Enter The Size of Array : "<<" 'Note that it has to be bigger than 0'\n";
cin>>N;
here I determine the size of the array
int z[N];
int n=sizeof(z)/sizeof(z[0]);
cout<<"The Number of elements in this array is : "<<n<<"\n";
I put the value of each elements
for(int i=0;i<N;i++){
cout<<"chose the "<<i<<" element : ";
cin>>z[i];
}
this loop for looking in the array and check if its positive, negative or zero
for(int i=0;i<N;i++){
if (z[i] > 0){
P=P+1;
}
else if (z[i] < 0){
N=N+1;
}
else{
zero=zero+1;
}
}
here to print the result
cout<<"The Number of Positive elements is : "<<P<<"\n";
cout<<"The Number of Negative elements is : "<<N<<"\n";
cout<<"The Number of zero elements is : "<<zero<<"\n";
the issue is that program ran without errors but it gives wrong results