Comparison with ifs always entering the first

Asked

Viewed 34 times

1

I’m trying to make comparison using if, but always goes on the first if:

 if((vetor[0] << vetor[1]) && (vetor [0] << vetor [2]) && (vetor [0] << vetor [3])){
    cout << "\n" << vetor [0] << "\n eh o menor \n"; }

    else if((vetor [1] << vetor [2]) && (vetor [1] << vetor [3])){
    cout << "\n" << vetor [1] << "\n eh o menor \n"; }

    else if ((vetor[2] << vetor[1]) && (vetor [2] << vetor [3])){
    cout << "\n" << vetor [2] << "\n eh o menor \n"; }

    else if ((vetor[3] << vetor[1]) && (vetor [3] << vetor [2])){
    cout << "\n" << vetor [3] << "\n eh o menor \n"; }

1 answer

2

<< and >> are not comparators

Change << for <, and >> for >.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.