#include<iostream>
#include<list>
#include<algorithm>
#include<vector>
using namespace std;
template<class T>
int reduce(T ar[], int n);
int main()
{
const int num = 10;
long arr[num] = {
1,5,5,8,3,3,3,2,9,6 };
string str[num] = {
"cpp","app","app","sun","sun","moom","sun","play","play","play" };
int n = reduce(arr, num);
int m = reduce(str, num);
cout << "n=: " << n;
cout << "\nm=: " << m;
return 0;
}
template<class T>
int reduce(T ar[], int n)
{
list<T> two;
two.insert(two.begin(), ar, ar + n);
two.unique();
return (two.size());
}
十六章第五题
猜你喜欢
转载自blog.csdn.net/wode_0828/article/details/108837318
今日推荐
周排行