-
Notifications
You must be signed in to change notification settings - Fork 9
/
lab2timing.cpp
27 lines (25 loc) · 1003 Bytes
/
lab2timing.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
/********************************************************************/
/* */
/* lab 2 timing file */
/* */
/* To compile: g++ lab2.cpp lab2timing.cpp timer.cpp -std=c++0x */
/* */
/* */
/********************************************************************/
#include "timer.h"
#include <iostream>
using namespace std;
unsigned int factorial (unsigned int n);
double power (double base, unsigned int n);
unsigned int fibonacci (unsigned int n);
int main(void){
unsigned int n = 35;
unsigned int rc;
Timer t;
t.start();
rc=fibonacci(n);
t.stop();
cout << "fibonacci (" << n << ") = " << rc << endl;
cout << "fibonacci (" << n << ") took " << t.currtime() << " s" << endl;
return 0;
}