-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eeec0a7
commit d38043a
Showing
6 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include <iostream> | ||
#include <chrono> | ||
|
||
// Recursive fibonacci sequence, this should take a while. | ||
uint64_t recursive_fib_seq(int x) { | ||
if (x == 0 || x == 1) return x; | ||
return recursive_fib_seq(x-1) + recursive_fib_seq(x-2); | ||
} | ||
// | ||
int main (int argc, char *argv[]) { | ||
// | ||
// // gets the current time (starting time). Do this before your code that you want to time. | ||
std::chrono::high_resolution_clock::time_point start = std::chrono::high_resolution_clock::now(); | ||
// | ||
// // Code that you want to time. | ||
std::cout << "Getting the fib sequence for of 40\n"; | ||
std::cout << "Result was: " << recursive_fib_seq(40) << std::endl; | ||
// // End of the code that you want to time. | ||
// | ||
// // Gets the new current time (ending time). Do this after the code you want to time. | ||
std::chrono::high_resolution_clock::time_point stop = std::chrono::high_resolution_clock::now(); | ||
// // calculates the difference in time in between start and stop. duration<double> calculates time in seconds. | ||
std::chrono::duration<double> time_span = std::chrono::duration_cast<std::chrono::duration<double> >(stop - start); | ||
// | ||
// // .count returns the time in seconds. | ||
std::cout << "It took me " << time_span.count() << " seconds." << std::endl; | ||
|
||
return 0; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// a hello world program for c++ | ||
|
||
#include <iostream> | ||
//using namespace std; | ||
|
||
int main() { | ||
std::cout << "Hello, world!\n"; | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include <iostream> | ||
using namespace std; | ||
|
||
int main() { | ||
int x; | ||
cin >> x; | ||
|
||
cout << x / 3 << ' ' << x * 2; | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include <iostream> | ||
using namespace std; | ||
|
||
int main() { | ||
int x; | ||
x = 4 + 2; | ||
cout << x / 4 << ' ' << x * 2; | ||
|
||
return 0; | ||
} |