array = [10.4 , 10.4,10.4 ,10.4,11.0]

Need to find the all the values in array are equal, if values are not equal get the first non equal value.

expected:

false for the above example.
get the value 11.0

This should do it, but only for that specific case

#include <iostream>

using namespace std;

int main()
{
    int i=0, t=5;
    float notequal = 0;
    float array[5] = {10.4 , 10.4, 10.4, 10.4, 11.4};
    while(t--){
        if(array[i] != array[t] && array[i] == array[i+1]) notequal = array[t];
        else if(array[i] != array[t] && array[t] == array[i+1]) notequal = array[i];

    }
    if(notequal == 0) cout << "Array is equal" << endl;
    else cout << "Array is not equal, number " << notequal << " is not equal to the others" << endl;
    return 0;
}