/// @file /// @brief Task1: "single-file" excutable C++ program /// @todo Include standard library headers as needed #include #include #include #include namespace task1 { /// @todo Implement a function 'count_unique' according to the description below: /// - a sequence of integer values is received via a parameter of type std::vector /// - the function finds the unique entries in the sequence by inserting each value into a std::unordered_set /// - the values in a std::unordered_set are unique, so the number of unique entries is the size of the set /// - the function then returns the number of unique entries /// @param sequence a sequence of integer values /// @return the number of unique entries in the sequence int count_unique(const std::vector& sequence) { return (std::set (sequence.begin(), sequence.end())).size(); } } // namespace task1 /// - fill a std::vector with with this sequence of values /// 1,1,10,2,2,3,4,5,6,7,8,9,10,3,3,11,12,13,14 /// - use your function to count the unique values in the sequence above /// - print the number of unique values to the console int main() { std::vector sequence = {1,1,10,2,2,3,4,5,6,7,8,9,10,3,3,11,12,13,14}; int unique_Count = task1::count_unique(sequence); std::cout << "Number of unique values: " << unique_Count << std::endl; return 0; }