[ create a new paste ] login | about

Link: http://codepad.org/xJUPWrjg    [ raw code | output | fork ]

C++, pasted on Jan 26:
1
2
3
4
5
6
7
8
9
10
11
12
#include <iostream>
#include <algorithm>

int main()
{
    int arr[] = { 1, 2, 2, 3, 4, 5, 5 };
    int N = sizeof(arr) / sizeof(arr[0]);
    std::cout << "Кол-во разных элементов: "
              << std::distance(arr, std::unique(arr, arr + N))
              << "\n";
    return 0;
}


Output:
1
Кол-во разных элементов: 5


Create a new paste based on this one


Comments: