摘要: 源程序: #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 阅读全文
posted @ 2020-02-05 23:31 bobo哥 阅读(111) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>using namespace std;template <class T> class Sample{ T n;public: Sample(T i) { n = i; } int operator ==(Sample &);}; template 阅读全文
posted @ 2020-02-05 23:05 bobo哥 阅读(132) 评论(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]; 阅读全文
posted @ 2020-02-05 22:30 bobo哥 阅读(118) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>using namespace std;template <class T> class A{private: T x, y, s;public: A(T a, T b) { x = a; y = b; s = x + y; } void show() 阅读全文
posted @ 2020-02-05 21:59 bobo哥 阅读(121) 评论(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) ? 阅读全文
posted @ 2020-02-05 21:48 bobo哥 阅读(148) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>#include <string>using namespace std;template<class T>class TBase{ T data1;public: void print() { cout << "TBase::" << data1 < 阅读全文
posted @ 2020-02-05 21:29 bobo哥 阅读(300) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>#include <string>using namespace std;template<class T>class TBase{ T data1;public: void print() { cout << "TBase::" << data1 < 阅读全文
posted @ 2020-02-05 21:26 bobo哥 阅读(120) 评论(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< 阅读全文
posted @ 2020-02-05 21:20 bobo哥 阅读(165) 评论(0) 推荐(0)
摘要: 源程序: #include<iostream>using namespace std;template<typename T>class Test{public: Test(T num) { k += num; } Test() { k += 1; } static void incrementK( 阅读全文
posted @ 2020-02-05 21:08 bobo哥 阅读(142) 评论(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 阅读全文
posted @ 2020-02-05 21:05 bobo哥 阅读(166) 评论(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>: 阅读全文
posted @ 2020-02-05 21:02 bobo哥 阅读(104) 评论(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 阅读全文
posted @ 2020-02-05 20:59 bobo哥 阅读(128) 评论(0) 推荐(0)
摘要: 源程序: #include<iostream>using namespace std;template<class T>T Max(T a, T b){ cout << "Template Max 1" << endl; return 0;}template<class T,class T2>T M 阅读全文
posted @ 2020-02-05 20:56 bobo哥 阅读(141) 评论(0) 推荐(0)
摘要: 源程序: #include<iostream>using namespace std;class myDate{public: myDate(); myDate(int, int, int); friend ostream & operator<<(ostream & os, const myDat 阅读全文
posted @ 2020-02-05 20:48 bobo哥 阅读(98) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>#include <string>using namespace std;template <typename T>int myCompare(const T& left, const T& right){ if (left<right) { retu 阅读全文
posted @ 2020-02-05 20:45 bobo哥 阅读(137) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>using namespace std;template<class T> //类类型Tvoid Swap(T &x, T &y) //可以交换类对象{ T tmp = x; x = y; y = tmp;}class myDate{public: m 阅读全文
posted @ 2020-02-05 20:13 bobo哥 阅读(142) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>using namespace std;template <typename T>T abs(T x){ return x<0 ? -x : x;}int main(){ int n = -5; int m = 10; double d = -.5; 阅读全文
posted @ 2020-02-05 20:00 bobo哥 阅读(145) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>#include <fstream>using namespace std; class triangle{private: int a, b, c; double area;public: triangle(int aa, int bb, int c 阅读全文
posted @ 2020-02-05 19:49 bobo哥 阅读(155) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>#include <fstream>using namespace std; int main(){ char k; int i; ofstream outf("c:\\tmp\\tem.dat",ios::trunc); outf << "Hello 阅读全文
posted @ 2020-02-05 18:47 bobo哥 阅读(190) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>#include <fstream>using namespace std; int main(){ int i; ifstream f1("c:\\tmp\\xt1.txt",ios::in); fstream f2("c:\\tmp\\xt2.tx 阅读全文
posted @ 2020-02-05 17:34 bobo哥 阅读(150) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>#include <fstream>using namespace std; int main(){ int i; ofstream ftxt1; ftxt1.open("c:\\tmp\\xt1.txt",ios::out); for (i = 1; 阅读全文
posted @ 2020-02-05 17:26 bobo哥 阅读(206) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>#include <fstream>using namespace std; class CStudent{public: char id[11]; //学号 char name[21]; //姓名 int score; //成绩};int main( 阅读全文
posted @ 2020-02-05 14:52 bobo哥 阅读(206) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>#include <fstream>#include <iomanip>using namespace std; class CStudent{public: char id[11]; //学号 char name[21]; //姓名 int scor 阅读全文
posted @ 2020-02-05 14:33 bobo哥 阅读(145) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>#include <fstream>#include <iomanip>using namespace std;class CStudent{public: char id[11]; //学号 char name[21]; //姓名 int score 阅读全文
posted @ 2020-02-05 13:52 bobo哥 阅读(117) 评论(0) 推荐(0)
摘要: 源程序: #include<iostream>#include<fstream>using namespace std;class CStudent{public: char id[11]; char name[21]; int score;};int main(){ char ch; cout < 阅读全文
posted @ 2020-02-05 13:48 bobo哥 阅读(135) 评论(0) 推荐(0)
摘要: 源程序: #include<iostream>#include<fstream>using namespace std;class CStudent{public: char id[11]; char name[21]; int score;};int main(){ CStudent stu; o 阅读全文
posted @ 2020-02-05 13:41 bobo哥 阅读(106) 评论(0) 推荐(0)
摘要: 源程序: #include<iostream>#include<fstream>#include<cstdlib>using namespace std;const int MAX_NUM = 1000;class CStudent{public: char id[11]; char name[21 阅读全文
posted @ 2020-02-05 13:34 bobo哥 阅读(149) 评论(0) 推荐(0)
摘要: 源程序: #include<iostream>#include<fstream>#include<iomanip>using namespace std;int main(){ char ch, filename[20]; int count = 0; bool newline = true; co 阅读全文
posted @ 2020-02-05 13:27 bobo哥 阅读(139) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>#include <fstream>#include <iomanip>using namespace std;int main(){ char id[11], name[21]; int score; ifstream inFile; inFile. 阅读全文
posted @ 2020-02-05 13:13 bobo哥 阅读(117) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>#include <fstream>using namespace std;int main(){ char id[11], name[21]; int score; ofstream outFile; outFile.open("c:\\tmp\\s 阅读全文
posted @ 2020-02-05 13:10 bobo哥 阅读(96) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>#include <fstream>using namespace std;int main(){ ifstream inFile("c:\\tmp\\test.txt", ios::in); //声明对象inFile并调用构造函数 if (inFil 阅读全文
posted @ 2020-02-05 13:02 bobo哥 阅读(139) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>#include <fstream>using namespace std;int main(){ ifstream inFile; inFile.open("c:\\tmp\\test.txt", ios::in); //以读的方式打开文本文件 if 阅读全文
posted @ 2020-02-05 12:58 bobo哥 阅读(137) 评论(0) 推荐(0)
摘要: 源程序: #include <string>#include <iostream>#include <algorithm>using namespace std;int main(){ string str = ""; getline(cin, str, '\n'); reverse(str.beg 阅读全文
posted @ 2020-02-05 12:39 bobo哥 阅读(111) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>#include <string>#include <iomanip>using namespace std; class student{private: string name1; float score1;public: int i; stude 阅读全文
posted @ 2020-02-05 11:59 bobo哥 阅读(131) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>#include <iomanip>#include <string>using namespace std; int main(){ double x = 3; cout << setiosflags(ios::showpoint|ios::fixe 阅读全文
posted @ 2020-02-05 09:27 bobo哥 阅读(127) 评论(0) 推荐(0)