-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlab-02.cpp
More file actions
48 lines (35 loc) · 828 Bytes
/
lab-02.cpp
File metadata and controls
48 lines (35 loc) · 828 Bytes
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
#include <cstring>
#include <string>
#include <vector>
#include "Point2d.h"
#include "factorial.h"
template <class T>
T min(T a, T b)
{
return (a < b) ? a : b;
}
template <>
const char* min(const char* a, const char* b)
{
return (strcmp(a, b) < 0) ? a : b;
}
int main()
{
{
std::cout << min(1, -1) << std::endl;
std::cout << min(0.1, -1.1) << std::endl;
std::cout << min<std::string>("aaa", "bbb") << std::endl;
const char * str1 = "aaa";
const char * str2 = "bbb";
std::cout << min(str1, str2) << std::endl;
}
{
std::cout << "6! = " << fact<6>() << std::endl;
std::cout << "7! = " << fact<7>() << std::endl;
}
{
Point2d<float> p(1.2, 1.2);
// p.compilationError();
Point2d<float> pi(1, 2);
}
}