cd src
#include <iostream> | |
// Defines one step in the Collatz conjecture sequence | |
// Read more about it here: https://en.wikipedia.org/wiki/Collatz_conjecture | |
int collatz(int n) | |
{ | |
return n % 2 ? n * 3 + 1 : n / 2; | |
} | |
int main() |
#include <iostream> | |
// Defines the Ackermann–Péter function. | |
// Read more about it and the Ackermann function in general here: https://en.wikipedia.org/wiki/Ackermann_function | |
int Ackermann(int m, int n) | |
{ | |
if (m == 0) return n+1; | |
else if (n == 0) return Ackermann(m-1, 1); | |
else return Ackermann(m-1, Ackermann(m, n-1)); | |
} |
#include <iostream> | |
#include <cmath> | |
int main() | |
{ | |
int integer1; | |
int integer2; | |
bool numberIsPrime; | |
std::cout << "Enter an integer: "; |
// Recursive function that does a smooth scroll | |
function smoothScroll() | |
{ | |
// We scroll again if we are not within 6 pixels of the destination | |
if(window.pageYOffset < positionToScrollTo - 6 || window.pageYOffset > positionToScrollTo) | |
{ | |
// The setTimeout creates the smooth scroll effect | |
setTimeout(function() | |
{ | |
window.scrollBy(0, window.pageYOffset < positionToScrollTo ? 6 : -6); // Scroll by 6 pixels |