Well, I have to find how many different numbers are in an array.
For example if array is: 1 9 4 5 8 3 1 3 5
The output should be 6, because 1,9,4,5,8,3 are uniqu
A std::set contains only unique elements already.
std::set
#include int main() { int a[] = { 1, 9, 4, 5, 8, 3, 1, 3, 5 }; std::set sa(a, a + 9); std::cout << sa.size() << std::endl; }