-
Notifications
You must be signed in to change notification settings - Fork 0
/
Collatz.h
65 lines (52 loc) · 1.23 KB
/
Collatz.h
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
// --------------------------
// projects/collatz/Collatz.h
// Copyright (C) 2015
// Glenn P. Downing
// --------------------------
#ifndef Collatz_h
#define Collatz_h
// --------
// includes
// --------
#include <iostream> // istream, ostream
#include <string> // string
#include <utility> // pair
using namespace std;
// ------------
// collatz_read
// ------------
/**
* read two ints
* @param s a string
* @return a pair of ints, representing the beginning and end of a range, [i, j]
*/
pair<int, int> collatz_read (const string& s);
// ------------
// collatz_eval
// ------------
/**
* @param i the beginning of the range, inclusive
* @param j the end of the range, inclusive
* @return the max cycle length of the range [i, j]
*/
int collatz_eval (int i, int j);
// -------------
// collatz_print
// -------------
/**
* print three ints
* @param w an ostream
* @param i the beginning of the range, inclusive
* @param j the end of the range, inclusive
* @param v the max cycle length
*/
void collatz_print (ostream& w, int i, int j, int v);
// -------------
// collatz_solve
// -------------
/**
* @param r an istream
* @param w an ostream
*/
void collatz_solve (istream& r, ostream& w);
#endif // Collatz_h