Project 3 - Currency Type
Main Page
Classes
Files
File List
File Members
gcd.hpp
1
#ifndef GCD_HPP_
2
#define GCD_HPP_
3
7
template
<
class
T>
8
T gcd(T n, T m)
9
{
10
static
const
T zero{};
11
if
(n < zero)
12
n = -n;
13
while
(m != zero) {
14
T tmp{n % m};
15
n = m;
16
m = tmp;
17
}
18
return
n;
19
}
20
21
#endif
Generated by
1.8.5