-
Notifications
You must be signed in to change notification settings - Fork 0
/
Block Reward Calculator.cpp
57 lines (40 loc) · 1.13 KB
/
Block Reward Calculator.cpp
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
//
// main.cpp
// block calculator
//
// Created by Gabriel Garrett on 1/30/14.
// Copyright (c) 2014 Gabriel Garrett. All rights reserved.
// https://github.com/ggaabe/Cryptocurrency-Block-Reward-Calculator
// https://github.com/ggaabe
#include <iostream>
using namespace std;
int main()
{
double calcBlock;
double reduction;
double reductionOccur;
int currentBlock;
cout << "Enter number of coins per block originally:"
<< endl;
cin >> calcBlock;
cout << "Enter the current block number : ";
cin >> currentBlock;
cout << endl;
cout << "Enter how often the block reward reduces: ";
cin >> reductionOccur;
cout << endl;
cout << "Enter the percentage rate the reward is reduced every reward reduction period: ";
cin >> reduction;
cout << endl;
int times = (currentBlock / reductionOccur);
for (int i = 0; i <= times; i++)
{
double newblock = calcBlock * (1 - (reduction/100));
//cout << (reduction / 100);
calcBlock = newblock;
}
cout << "Current block reward is: " << calcBlock << " per block.";
cout << endl;
system("pause");
return 0;
}