-
Notifications
You must be signed in to change notification settings - Fork 0
/
eu0013.cpp
74 lines (64 loc) · 1.75 KB
/
eu0013.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#include"eu0013.h"
#include"principal.h"
void eu0013 :: solucion(){
// ---------------------------------------------------- //
tstart = (double)clock()/CLOCKS_PER_SEC;
// ---------------------------------------------------- //
output = 0;
// ---------------------------------------------------- //
char uu[3];
myfile_read_1.open("eu0013_data.txt");
myfile_read_1.setf( ios::fixed );
temp_2 = 0;
temp_3 = 0;
temp_4 = 0;
temp_5 = 0;
temp_6 = 0;
for( unsigned int i=0; i<100; i++ ){
for( unsigned int j=0; j<10; j++ ){
myfile_read_1.get(uu, 2);
temp_1 = strtold(uu,0);
temp_2 = temp_2+temp_1*pow( 10, 9-j );
}
for( unsigned int j=0; j<10; j++ ){
myfile_read_1.get(uu, 2);
temp_1 = strtold(uu,0);
temp_3 = temp_3+temp_1*pow( 10, 9-j );
}
for( unsigned int j=0; j<10; j++ ){
myfile_read_1.get(uu, 2);
temp_1 = strtold(uu,0);
temp_4 = temp_4+temp_1*pow( 10, 9-j );
}
for( unsigned int j=0; j<10; j++ ){
myfile_read_1.get(uu, 2);
temp_1 = strtold(uu,0);
temp_5 = temp_5+temp_1*pow( 10, 9-j );
}
for( unsigned int j=0; j<10; j++ ){
myfile_read_1.get(uu, 2);
temp_1 = strtold(uu,0);
temp_6 = temp_6+temp_1*pow( 10, 9-j );
}
myfile_read_1.ignore(1,' ');
}
temp_6 = temp_6/10000000000;
temp_5 += temp_6;
temp_5 = temp_5/10000000000;
temp_4 += temp_5;
temp_4 = temp_4/10000000000;
temp_3 += temp_4;
temp_3 = temp_3/10000000000;
temp_2 += temp_3;
// cout<<endl<<"1: "<<temp_2;
output = temp_2/100;
// ---------------------------------------------------- //
tstop = (double)clock()/CLOCKS_PER_SEC;
ttime= tstop-tstart;
// ---------------------------------------------------- //
}
void eu0013 :: printsolution(){
cout << "Euler 0013\n";
cout << "Time: " << ttime << "\n";
cout << output;
}