How can I write an if statement or a loop to check if any of those elements contain the same value? As you can see in element 3 and 4 they both contain the value 8. How can I simply obtain which elements within the vector are the same?
Are you looking for adjacent duplicates (as 8 and 8 in your example), or duplicates in general? C++ provides a function to report the first adjacent duplicate: std::adjacent_find.
Are you looking for adjacent duplicates (as 8 and 8 in your example), or duplicates in general?
I am looking for duplicates in general, they do not need to be in any specific order I just need to know if the vector elements contain duplicates of any kind. Then I would like to be able to write a statement that says
1 2 3
if (the vector contains duplicates){ //Not sure what the syntax would be here
//Do some kind of action;
}