0
How does this even work????
int max; int arr[50] = {20, 10, 50, 30, 40, 70, 60, 80, 90, 100, 5,}; max = arr[0]; for(int i = 0; i < arr[i]; i++){ if( max < arr[i]){ max = arr[i]; } }
3 Answers
+ 3
Print max and arr[i] inside the loop to see what its going on
+ 2
int arr[50] = {20, 10, 50, 30, 40, 70, 60, 80, 90, 100, 5,};
int max = arr[0];
for(int i=0; i<50; i++) if(max<arr[i]) max = arr[i];
cout << max;
// Good Luck
+ 1
Thank you for the encouragement soloprog