- 博客(17)
- 资源 (2)
- 收藏
- 关注
原创 【程序设计与算法(三)第8周测验(2019秋季)】007:List
描述写一个程序完成以下命令:new id ——新建一个指定编号为id的序列(id<10000)add id num——向编号为id的序列加入整数nummerge id1 id2——合并序列id1和id2中的数,并将id2清空unique id——去掉序列id中重复的元素out id ——从小到大输出编号为id的序列中的元素,以空格隔开#include <list>...
2020-01-30 16:45:45 1484
原创 【程序设计与算法(三)第8周测验(2019秋季)】006:我自己的 ostream_iterator
描述程序填空输出指定结果#include <iostream>#include <list>#include <string>using namespace std;template <class T1,class T2>void Copy(T1 s,T1 e, T2 x){ for(; s != e; ++s,++x) *x...
2020-01-30 16:07:40 732
原创 【程序设计与算法(三)第8周测验(2019秋季)】005:白给的list排序
描述程序填空,产生指定输出#include <cstdio>#include <iostream>#include <algorithm>#include <list>using namespace std;int main(){ double a[] = {1.2,3.4,9.8,7.3,2.6}; list<doubl...
2020-01-30 15:07:57 1397
原创 【程序设计与算法(三)第8周测验(2019秋季)】004:函数对象的过滤器
描述程序填空输出指定结果#include <iostream>#include <vector>using namespace std;struct A { int v; A() { } A(int n):v(n) { }; bool operator<(const A & a) const { return v < a.v;...
2020-01-30 14:55:40 676
原创 【程序设计与算法(三)第8周测验(2019秋季)】003:很难蒙混过关的CArray3d三维数组模板类
描述实现一个三维数组模版CArray3D,可以用来生成元素为任意类型变量的三维数组,输出指定结果#include <iostream>#include <iomanip> #include <cstring>using namespace std;template <class T>class CArray3D{// 在此处补充你的...
2020-01-30 14:23:37 474
原创 【程序设计与算法(三)第8周测验(2019秋季)】002:按距离排序
描述程序填空,输出指定结果#include <iostream>#include <cmath>#include <algorithm>#include <string>using namespace std;template <class T1,class T2>struct Closer {// 在此处补充你的代码...
2020-01-29 17:24:22 928
原创 【程序设计与算法(三)第8周测验(2019秋季)】001:goodcopy
描述编写GoodCopy类模板,使得程序按指定方式输出#include <iostream>using namespace std;template <class T>struct GoodCopy {// 在此处补充你的代码 int size; T* temp; void operator()(T* _start, T* _end,...
2020-01-29 15:51:44 868
原创 【程序设计与算法(三)第7周测验(2019秋季)】004:你真的搞清楚为啥 while(cin >> n) 能成立了吗?
描述读入两个整数,输出两个整数 ,直到碰到-1#include <iostream>using namespace std;class MyCin{// 在此处补充你的代码public: MyCin(){} istream& operator>> (int &_x) { cin >> _x;...
2020-01-28 20:52:49 1116 4
原创 【程序设计与算法(三)第7周测验(2019秋季)】007:排序,又见排序!
描述自己编写一个能对任何类型的数组进行排序的mysort函数模版。只能写一个mysort模板,不能写mysort函数!#include <iostream>using namespace std;bool Greater2(int n1,int n2) { return n1 > n2;}bool Greater1(int n1,int n2) { retu...
2020-01-28 20:48:56 883
原创 【程序设计与算法(三)第7周测验(2019秋季)】006:这个模板并不难
描述程序填空,输出指定结果#include <iostream>#include <string>#include <cstring>using namespace std;template <class T> class myclass {// 在此处补充你的代码public: T *p, *p_temp; in...
2020-01-28 20:05:10 1406 1
原创 【C++】自加运算符重载
前置++:实现自增后,返回引用后置++:先保存当前对象的副本,实现自增操作后,返回副本前置++:CInt& operator ++()//前置++{ ++data; return *this;}参数: void返回值: 引用(CInt&),返回当前对象要使用引用,如果返回类型为CInt,返回的对象为临时量后置++:const CInt operat...
2020-01-28 19:45:28 336
原创 【程序设计与算法(三)第7周测验(2019秋季)】005:山寨版istream_iterator
描述读入两个整数,输出两个整数 ,直到碰到-1#include <iostream>using namespace std;class MyCin{// 在此处补充你的代码public: MyCin(){} istream& operator>> (int &_x) { cin >> _x;...
2020-01-28 18:37:30 575
原创 【程序设计与算法(三)第7周测验(2019秋季)】003:简单的Filter
编写Filter模板,使得程序产生指定输出 不得编写 Filter函数#include <iostream>#include <string>using namespace std;// 在此处补充你的代码template <class T, class Pred>T* Filter(T* _start, T* _end, T* x, Pred op...
2020-01-28 17:33:29 530
原创 【程序设计与算法(三)第7周测验(2019秋季)】002:简单的foreach
描述编写MyForeach模板,使程序按要求输出 不得编写 MyForeach函数#include <iostream>#include <string>using namespace std;// 在此处补充你的代码template<class T, class Pred>void MyForeach(T* _start, T* _end, Pr...
2020-01-28 12:24:57 518
原创 【程序设计与算法(三)第7周测验(2019秋季)】001:简单的SumArray
#include <iostream> #include <string> using namespace std; template <class T> T SumArray(T *_start, T *_end){// 在此处补充你的代码 T sum = *_start; while(++_start<_end){ ...
2020-01-23 00:38:09 1553
原创 【Pytorch】模型保存&调用
保存&加载模型参数# save parameterif accuracy > best_accuracy: torch.save(model.state_dict(), '.\\parameter.pk1') #save parameter# load parametermodel = TheModelClass(...)model.load_state_dict(...
2020-01-11 19:06:03 640
FFmpeg_x64动态库测试程序
2020-03-25
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人