-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
31 lines (24 loc) · 843 Bytes
/
main.cpp
File metadata and controls
31 lines (24 loc) · 843 Bytes
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
/*
* main.cpp
* ========
* Copyright 2013 Paul Griffiths
* Email: mail@paulgriffiths.net
*
* Sample usage of financial library.
*
* Distributed under the terms of the GNU General Public License.
* http://www.gnu.org/licenses/
*/
#include <iostream>
#include <paulgrif/financial.h>
int main(void) {
const double pv = financial::pv(100, 1, 0.05);
std::cout << "PV of 100 in 1 period at 5% is: " << pv << std::endl;
const double pv2 = financial::pv(100, 2, 0.05);
std::cout << "PV of 100 in 2 periods at 5% is: " << pv2 << std::endl;
const double fv = financial::fv(pv, 1, 0.05);
std::cout << "FV of 95.2381 in 1 period at 5% is: " << fv << std::endl;
const double fv2 = financial::fv(pv2, 2, 0.05);
std::cout << "FV of 90.7029 in 2 periods at 5% is: " << fv2 << std::endl;
return 0;
}