文章分类 -  自考教材 C++(2019版)课本内容

1 2 3 4 5 ··· 11 下一页
摘要:point.h #pragma once#ifndef POINT_H#define POINT_H#include<iostream>#include<stdlib.h>using namespace std;const double PI = 3.1415926; //定义基类class Poi 阅读全文
posted @ 2020-06-07 17:28 CollisionDimension 阅读(199) 评论(7) 推荐(1)
摘要:function.h #pragma once#ifndef FUNCTION_H#define FUNCTION_H class volume {private: double length, width, height;public: volume() {}; volume(double l, 阅读全文
posted @ 2020-06-07 17:23 CollisionDimension 阅读(75) 评论(0) 推荐(0)
摘要:#include <iostream>#define N 5using namespace std; template <typename T> //冒泡排序 /* void bubble_sort(T a[], int n) { int i, j; T temp; for (i = 0; i < 阅读全文
posted @ 2020-04-21 08:27 CollisionDimension 阅读(134) 评论(0) 推荐(0)
摘要:#include <iostream>using namespace std;template <class T> class max{private: T x, y;public: max(T a, T b) { x = a; y = b; } T compare() { return (x > 阅读全文
posted @ 2020-04-21 08:25 CollisionDimension 阅读(109) 评论(0) 推荐(0)
摘要:#include <iostream>using namespace std;template <class T> class Sample{ T n;public: Sample(T i) { n = i; } int operator ==(Sample &);}; template <clas 阅读全文
posted @ 2020-04-21 08:22 CollisionDimension 阅读(94) 评论(0) 推荐(0)
摘要:#include <iostream>using namespace std;template <class T> void f(T a[],int n){ T t; for (int i = 0; i < n / 2; i++) { t = a[i]; a[i] = a[n-i-1]; a[n - 阅读全文
posted @ 2020-04-21 08:20 CollisionDimension 阅读(100) 评论(0) 推荐(0)
摘要:#include <iostream>using namespace std;template <class T> class f{public: T x, y; void f1(T a, T b) { x = a; y = b; } T max() { return (x > y) ? x : y 阅读全文
posted @ 2020-04-21 08:14 CollisionDimension 阅读(89) 评论(0) 推荐(0)
摘要:#include <iostream>using namespace std;template <class T> class f{public: T x, y; void f1(T a, T b) { x = a; y = b; } T max() { return (x > y) ? x : y 阅读全文
posted @ 2020-04-21 08:06 CollisionDimension 阅读(94) 评论(0) 推荐(0)
摘要:#include<iostream>#include<string>using namespace std;template<class T>class TBase{ T data1; public: void print() { cout<<"TBase::"<<data1<<endl; }};t 阅读全文
posted @ 2020-04-20 09:58 CollisionDimension 阅读(92) 评论(0) 推荐(0)
摘要:#include<iostream>#include<string>using namespace std; template<class T>class TBase{private: T data1;public: void print() { cout<<"TBase::"<<data1<<en 阅读全文
posted @ 2020-04-20 09:56 CollisionDimension 阅读(121) 评论(0) 推荐(0)
摘要:#include<iostream>#include<string>using namespace std;class TBase{ int k;public: void print() { cout<<"TBase::"<<k<<endl; }}; template<class T>class T 阅读全文
posted @ 2020-04-20 09:50 CollisionDimension 阅读(193) 评论(0) 推荐(0)
摘要:/* 类模板与继承: ~P345类之间允许继承,类模板之间也允许继承。1)普通类继承模板类。2)类模板继承普通类。3)类模板继承类模板。4)类模板继承模板类。 */ #include<iostream>using namespace std;template<class T>class TBase{ 阅读全文
posted @ 2020-04-20 09:45 CollisionDimension 阅读(394) 评论(0) 推荐(0)
摘要:#include<iostream>using namespace std;template<int i>class TestClass{ public: int buffer[i]; int getData(int j);};template<int i>int TestClass<i>::get 阅读全文
posted @ 2020-04-20 09:42 CollisionDimension 阅读(142) 评论(0) 推荐(0)
摘要:/* 类模板中允许有静态成员。实际上,定义的静态成员是类模板实例化后的类的静态成员。也就是说,对于一个类模板的每一个实例化类,其所有的对象共享其静态成员。 */ #include<iostream>using namespace std;template<typename T>class Test{ 阅读全文
posted @ 2020-04-19 08:59 CollisionDimension 阅读(296) 评论(0) 推荐(0)
摘要:#include<iostream>#include<string>using namespace std;template<class T1,class T2>class Pair{public: T1 first; T2 second; Pair(T1 k,T2 v):first(k),seco 阅读全文
posted @ 2020-04-19 08:57 CollisionDimension 阅读(82) 评论(0) 推荐(0)
摘要:#include<iostream>using namespace std;template<class T>class TestClass{ public: T buffer[10]; T getData(int j);};template <class T>T TestClass<T>::get 阅读全文
posted @ 2020-04-19 08:46 CollisionDimension 阅读(57) 评论(0) 推荐(0)
摘要:#include<iostream>#include<string>using namespace std; template<class T1,class T2>class Pair{ public: T1 first; T2 second; Pair(T1 k,T2 v):first(k),se 阅读全文
posted @ 2020-04-18 08:24 CollisionDimension 阅读(82) 评论(0) 推荐(0)
摘要:#include<iostream>using namespace std; template<class T>T Max(T a){ cout<<"Template Max 1"<<endl; return 0;} template<class T,class T2>T Max(T a,T2 b) 阅读全文
posted @ 2020-04-18 08:22 CollisionDimension 阅读(89) 评论(0) 推荐(0)
摘要:/* 函数模板可以重载,只要它们的形参表不同即可。*函数或函数模板调用语句的匹配顺序:1)先找参数完全匹配的普通函数(不是由模板实例化得到的模板函数)2)再找参数完全匹配的模板函数。3)然后找实参经过自动类型转换后能够匹配的普通函数。4)如果上面的都找不到,则报错。 */ #include<iost 阅读全文
posted @ 2020-04-18 08:17 CollisionDimension 阅读(152) 评论(0) 推荐(0)
摘要:#include<iostream>#include<string>using namespace std; template<typename T>int myCompare(const T& left,const T& right){ if(left<right) { return-1; } e 阅读全文
posted @ 2020-04-17 10:40 CollisionDimension 阅读(120) 评论(0) 推荐(0)

1 2 3 4 5 ··· 11 下一页