I am trying to find the minimum number when the user enters any 5 numbers

I am not sure why this code is not working, every time I run this function I always get 0. Can someone please tell me what is wrong!

    int i;
    int num1 = 5;
    int min;
    min = arraySize[0];
    arraySize[num1];

    cout<<"Enter values (press enter after inputting every number): "<<endl;
    for (i=0; i<5; i++)
    {
    cin >> arraySize[i];      
    }

    for(i=1; i<5; i++)
    {
       if(min > arraySize[i])
       {
       min = arraySize[i];
       }
    }
     cout << "Your mininum number is " << min << endl; 

You have assigned min from arraySize[0] before it was initialized. You are lucking that it was initialized to zero - it just as easily could have been garbage. So, change then initial assignment from min = arraySize[0] to min = 0, and then change the for() loop to determine min from for (i = 1; i < 5; i++) to for (i = 0; i < 5; i++)

I did what you said, and it still returns 0; I have my arraySize declared as int arraySize[]; where I have my methods declared in my class. I am not sure if this has anything to do with it.

Not quite. After you input all the numbers, set min to arraySize[0].
Then you code should work fine.

This question has already been answered. Start a new discussion instead.