-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathlength_lit.cpp
More file actions
55 lines (43 loc) · 1.27 KB
/
length_lit.cpp
File metadata and controls
55 lines (43 loc) · 1.27 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
double FT_IN_M = 1.0 / 0.3048;
double FT_IN_INCHES = 12.0;
double INCH_IN_CM = 2.54;
// Футы в другие величины
double operator""_ft_to_m(long double ft) {
return ft / FT_IN_M;
}
double operator""_ft_to_cm(long double ft) {
return ft / FT_IN_M * 100.0;
}
double operator""_ft_to_in(long double ft) {
return ft * FT_IN_INCHES;
}
// Дюймы в другие величины
double operator""_in_to_ft(long double in) {
return in / FT_IN_INCHES;
}
double operator""_in_to_cm(long double in) {
return in * INCH_IN_CM;
}
double operator""_in_to_m(long double inches) {
return inches * INCH_IN_CM / 100;
}
// См в другие величины
double operator""_cm_to_m(long double centimeters) {
return centimeters / 100;
}
double operator""_cm_to_in(long double centimeters) {
return centimeters / INCH_IN_CM;
}
double operator""_cm_to_ft(long double centimeters) {
return centimeters / (FT_IN_INCHES * INCH_IN_CM);
}
// Метры в другие величины
double operator""_m_to_ft(long double meters) {
return meters * 100 / (INCH_IN_CM * FT_IN_INCHES);
}
double operator""_m_to_in(long double meters) {
return meters * 100 / INCH_IN_CM;
}
double operator""_m_to_cm(long double meters) {
return meters * 100;
}