随笔分类 -  C++面向对象程序设计

北大 中国大学MOOC C++面向对象程序设计 习题记录
摘要:#include <iostream> #include <math.h> using namespace std; bool is_prime(unsigned long long n) { //quick unsigned long long stop = n / 6 + 1, Tstop = 阅读全文
posted @ 2022-03-03 14:06 icefield817 阅读(142) 评论(0) 推荐(0)
摘要:#include <iostream> #include <string> #include <map> #include <iterator> #include <algorithm> using namespace std; // 在此处补充你的代码 template<class T1,clas 阅读全文
posted @ 2022-03-02 10:43 icefield817 阅读(225) 评论(0) 推荐(0)
摘要:#include <iostream> #include <string> #include <sstream> #include <set> #include <map> using namespace std; int main() { typedef multimap<int, int,les 阅读全文
posted @ 2022-03-01 21:10 icefield817 阅读(104) 评论(0) 推荐(0)
摘要:#include <iostream> #include <string> #include <sstream> #include <set> #include <map> using namespace std; int main() { typedef map<int, int,less<int 阅读全文
posted @ 2022-03-01 17:57 icefield817 阅读(120) 评论(0) 推荐(0)
摘要:#include <iostream> #include <string> #include <set> using namespace std; int main() { multiset<int> ss; set<int> his; int cmd ; cin >> cmd; for (int 阅读全文
posted @ 2022-03-01 10:15 icefield817 阅读(65) 评论(0) 推荐(0)
摘要:#include <iostream> #include <string> #include <list> using namespace std; list<int> no; int getIndex(int id) { int res=0; list<int>::iterator ii; for 阅读全文
posted @ 2022-02-28 17:09 icefield817 阅读(60) 评论(0) 推荐(0)
摘要:#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; 阅读全文
posted @ 2022-02-28 15:52 icefield817 阅读(142) 评论(0) 推荐(0)
摘要:#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 }; lis 阅读全文
posted @ 2022-02-28 15:26 icefield817 阅读(109) 评论(0) 推荐(0)
摘要:#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 < 阅读全文
posted @ 2022-02-28 14:56 icefield817 阅读(76) 评论(0) 推荐(0)
摘要:#include <iostream> #include <iomanip> #include <cstring> using namespace std; template <class T> class CArray3D { // 在此处补充你的代码 public: int x, y, z; T 阅读全文
posted @ 2022-02-28 14:38 icefield817 阅读(289) 评论(0) 推荐(0)
摘要:#include <iostream> #include <cmath> #include <algorithm> #include <string> using namespace std; template <class T1, class T2> struct Closer { // 在此处补 阅读全文
posted @ 2022-02-28 10:41 icefield817 阅读(98) 评论(0) 推荐(0)
摘要:#include <iostream> using namespace std; template <class T> struct GoodCopy { // 在此处补充你的代码 GoodCopy() {} void operator()(T * arr, T * arrEnd, T * brr) 阅读全文
posted @ 2022-02-27 16:22 icefield817 阅读(95) 评论(0) 推荐(0)
摘要:#include <iostream> using namespace std; bool Greater2(int n1, int n2) { return n1 > n2; } bool Greater1(int n1, int n2) { return n1 < n2; } bool Grea 阅读全文
posted @ 2022-02-24 17:54 icefield817 阅读(132) 评论(0) 推荐(0)
摘要:#include <iostream> #include <string> #include <cstring> using namespace std; template <class T> class myclass { // 在此处补充你的代码 public: T * p; int size; 阅读全文
posted @ 2022-02-24 13:14 icefield817 阅读(75) 评论(0) 推荐(0)
摘要:#include <iostream> #include <string> using namespace std; template <class T> class CMyistream_iterator { // 在此处补充你的代码 public: T a; CMyistream_iterato 阅读全文
posted @ 2022-02-24 11:56 icefield817 阅读(120) 评论(0) 推荐(0)
摘要:#include <iostream> using namespace std; class MyCin { // 在此处补充你的代码 public: bool flag = false; MyCin & operator>> (int & n) { cin >> n; if (n == -1 || 阅读全文
posted @ 2022-02-23 17:52 icefield817 阅读(215) 评论(0) 推荐(0)
摘要:#include <iostream> #include <string> using namespace std; // 在此处补充你的代码 template<class T,class F> T Filter(T ar,T arEnd, T resAr, F fun) { for (ar;ar 阅读全文
posted @ 2022-02-23 16:59 icefield817 阅读(112) 评论(0) 推荐(0)
摘要:#include <iostream> #include <string> using namespace std; template <class T> T SumArray(T(*ar), T(*arEnd)) { if (ar == arEnd) return * ar; T res = *a 阅读全文
posted @ 2022-02-23 12:10 icefield817 阅读(92) 评论(0) 推荐(0)
摘要:#include <iostream> #include <string> using namespace std; // 在此处补充你的代码 template<class T, class F> void MyForeach(T ar,T arEnd,F fun) { for (;ar != ar 阅读全文
posted @ 2022-02-23 12:08 icefield817 阅读(126) 评论(0) 推荐(0)
摘要:#include <iostream> using namespace std; class A { private: int nVal; public: void Fun() { cout << "A::Fun" << endl; }; virtual void Do() { cout << "A 阅读全文
posted @ 2022-02-22 11:05 icefield817 阅读(93) 评论(0) 推荐(0)