-
Notifications
You must be signed in to change notification settings - Fork 0
/
eu0002.cpp
39 lines (31 loc) · 850 Bytes
/
eu0002.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
#include"eu0002.h"
#include"principal.h"
void eu0002 :: solucion(){
// ---------------------------------------------------- //
tstart = (double)clock()/CLOCKS_PER_SEC;
// ---------------------------------------------------- //
output = 0;
// ---------------------------------------------------- //
temp_1 = 1;
temp_2 = 2;
temp_3 = 3;
output = 2;
for( unsigned int i=0; i<4000000; i++ ){
temp_1 = temp_3 + temp_2;
temp_2 = temp_1 + temp_3;
temp_3 = temp_1 + temp_2;
if( temp_2>4000000 ){
break;
}
output += temp_2;
}
// ---------------------------------------------------- //
tstop = (double)clock()/CLOCKS_PER_SEC;
ttime= tstop-tstart;
// ---------------------------------------------------- //
}
void eu0002 :: printsolution(){
cout << "Euler 0002\n";
cout << "Time: " << ttime << "\n";
cout << output;
}