会员
周边
新闻
博问
融资
云市场
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
smartlearn
博客园
首页
新随笔
新文章
联系
订阅
管理
2024年2月21日
【C++】编写一个具有老式风格接口的函数,其原型如下:int reduce(long arr[], int n)。实参应是数组名和数组中的元素个数。该函数对数组进行排序,删除重复的值,返回缩减后数组中的元素数目。请使用STL函数编写该函数(如果决定使用通用的unique( )函数,请注意它将返回结果区间的结尾)。使用一个小程序测试该函数。
摘要: #include <iostream> #include <string> using namespace std; int reduce(long arr[], int n) { sort(arr, arr + n); auto str = unique(arr, arr + n); return
阅读全文
posted @ 2024-02-21 17:47 wshidaboss
阅读(1)
评论(0)
推荐(0)
编辑