-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlearn.h
More file actions
80 lines (60 loc) · 1.31 KB
/
learn.h
File metadata and controls
80 lines (60 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#include <deque>
#include <vector>
#include <iostream>
#include <cstdio>
#include <string>
#include <list>
#include <map>
using namespace std;
#ifndef LEARN_H_
#define LEARN_H_
template <class T> T GetMax (T a, T b) {
T result;
result = (a>b)? a : b;
return (result);
};
template <class T> class pairs {
T value1, value2;
public:
pairs (T first, T second) {
value1=first;
value2=second;
}
T getmax ();
};
//注意1T定义2T返回类型3T传入类型
template <class T> T pairs<T>::getmax (){
T retval;
retval = value1>value2? value1 : value2;
return retval;
};
class Learn {
public:
int addition (int a, int b);
int subtraction (int a, int b);
void test();
void test1();
void test2();
// double betsy(int);
// double pam(int);
// void estimate(int lines, double (*pf)(int));
// void test3();
void swapr(int& a, int& b);
void swapp(int* p, int* q);
void swapv(int a, int b);
void test4();
};
class CRectangle {
int width, height;
public:
void set_values (int, int);
int area (void) {return (width * height);}
};
class CVector {
public:
int x,y;
CVector () {};
CVector (int,int);
CVector operator + (CVector);
};
#endif