-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest1.cpp
82 lines (63 loc) · 1.25 KB
/
test1.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
75
76
77
78
79
80
81
82
#include <ctime>
#include <iostream>
using namespace std;
void printkchars(char a, int k) {
for (int i = 0; i < k; i++) {
cout << a;
}
}
//learn to draw a spiral could just draw onto a textpad
int fibonacci(int n){
//cout << n << endl;
if (n < 2) return n;
return fibonacci(n-1) + fibonacci(n-2);
}
int fibonacciTwo (int n){
}
int main(){
int n;
int res;
cin >> n;
cout << "#include <iostream>" << endl;
cout << "using namespace std;" << endl;
cout << "int main() {";
cout << "int n;";
cout << "cin >> n;";
cout << endl;
cout <<" switch (n) {";
for (int i = 0; i < n; i++){
clock_t begin = clock();
res = fibonacci(i);
clock_t end = clock();
double elapsed_secs = double(end - begin) / CLOCKS_PER_SEC;
//cout << i << " " << res << " "<< elapsed_secs << endl;
cout << "case " << i << ": cout << " << res << "; break;";
}
cout << "} }";
return 0;
}
/*
int main(){
int t = 0;
int l, h;
cin >> l >> h;
for (int i = 0; i < h; i++){
switch (i % 4) {
//check for even
case 0:
case 2:
printkchars('*', l);
break;
case 3:
printkchars(' ', l-1);
printkchars('*', 1);
break;
case 1:
printkchars('*', 1);
printkchars(' ', l-1);
break;
}
cout << endl;
}
}
*/