随笔分类 - 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 =
阅读全文
摘要:#include <iostream> #include <string> #include <map> #include <iterator> #include <algorithm> using namespace std; // 在此处补充你的代码 template<class T1,clas
阅读全文
摘要:#include <iostream> #include <string> #include <sstream> #include <set> #include <map> using namespace std; int main() { typedef multimap<int, int,les
阅读全文
摘要:#include <iostream> #include <string> #include <sstream> #include <set> #include <map> using namespace std; int main() { typedef map<int, int,less<int
阅读全文
摘要:#include <iostream> #include <string> #include <set> using namespace std; int main() { multiset<int> ss; set<int> his; int cmd ; cin >> cmd; for (int
阅读全文
摘要:#include <iostream> #include <string> #include <list> using namespace std; list<int> no; int getIndex(int id) { int res=0; list<int>::iterator ii; for
阅读全文
摘要:#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;
阅读全文
摘要:#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
阅读全文
摘要:#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 <
阅读全文
摘要:#include <iostream> #include <iomanip> #include <cstring> using namespace std; template <class T> class CArray3D { // 在此处补充你的代码 public: int x, y, z; T
阅读全文
摘要:#include <iostream> #include <cmath> #include <algorithm> #include <string> using namespace std; template <class T1, class T2> struct Closer { // 在此处补
阅读全文
摘要:#include <iostream> using namespace std; template <class T> struct GoodCopy { // 在此处补充你的代码 GoodCopy() {} void operator()(T * arr, T * arrEnd, T * brr)
阅读全文
摘要:#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
阅读全文
摘要:#include <iostream> #include <string> #include <cstring> using namespace std; template <class T> class myclass { // 在此处补充你的代码 public: T * p; int size;
阅读全文
摘要:#include <iostream> #include <string> using namespace std; template <class T> class CMyistream_iterator { // 在此处补充你的代码 public: T a; CMyistream_iterato
阅读全文
摘要:#include <iostream> using namespace std; class MyCin { // 在此处补充你的代码 public: bool flag = false; MyCin & operator>> (int & n) { cin >> n; if (n == -1 ||
阅读全文
摘要:#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
阅读全文
摘要:#include <iostream> #include <string> using namespace std; template <class T> T SumArray(T(*ar), T(*arEnd)) { if (ar == arEnd) return * ar; T res = *a
阅读全文
摘要:#include <iostream> #include <string> using namespace std; // 在此处补充你的代码 template<class T, class F> void MyForeach(T ar,T arEnd,F fun) { for (;ar != ar
阅读全文
摘要:#include <iostream> using namespace std; class A { private: int nVal; public: void Fun() { cout << "A::Fun" << endl; }; virtual void Do() { cout << "A
阅读全文

浙公网安备 33010602011771号