Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Latest commit

History

History
28 lines (24 loc) 路 789 Bytes

equal.md

File metadata and controls

28 lines (24 loc) 路 789 Bytes

equal

Description : Compares the elements of a vector in a given range to the elements of another vector in the previously defined range.

Example :

    std::vector<int> v1 {3, 5, 3, 1, 2, 3};
    std::vector<int> v2 {1, 2 ,3, 4, 5, 6};
    std::vector<int> v3 {3, 5, 3, 1, 2, 3};

    // Compare two equal vectors
    if(std::equal(v1.begin(),v1.end(),v3)){
        std::cout << "Vectors are equa!";
    }
    else {
        std::cout << "Vectors are not equal";
    }

    // Compare two unequal vectors
        if(std::equal(v1.begin(),v1.end(),v2)){
        std::cout << "Vectors are equa!";
    }
    else {
        std::cout << "Vectors are not equal";
    }

See Sample Code Run Code