-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathlab_harmony.cpp
More file actions
66 lines (40 loc) · 1.24 KB
/
lab_harmony.cpp
File metadata and controls
66 lines (40 loc) · 1.24 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
#include <iostream>
#include <tuple>
#include <vector>
using namespace std;
int harmony( int a, int b )
{
return 0;
}
int main()
{
vector< tuple<int,int,int> > tests {make_tuple(42, 69, 25),
make_tuple(123, 999, 50),
make_tuple(255, 254, 88),
make_tuple(127, 128, 0),
make_tuple(255, 126, 75),
make_tuple(515, 3, 100),
make_tuple(2147483647, 255, 100) };
int errors = 0;
for( auto test : tests )
{
int yourAnswer = harmony( get<0>(test), get<1>(test) );
if( yourAnswer != get<2>(test) )
{
cout << "Error when comparing " << get<0>(test) << " and " << get<1>(test) << endl
<< "Yours : " << yourAnswer << endl
<< "Correct: " << get<2>(test) << endl
<< endl;
errors += 1;
}
}
if( errors == 0)
{
cout << "Congratulations, no errors" << endl;
}
else
{
cout << "Uh oh, " << errors << " error/s remain" << endl;
}
return errors;
}