adding a helloworld.php because php is a good language ! and a strange way to display the fibonacci serie ahah

This commit is contained in:
Alexandre Plateau 2018-10-07 19:33:15 +02:00 committed by Luke Oliff
parent f357770592
commit f0c0410eb6
2 changed files with 43 additions and 0 deletions

40
code/do_strange_stuff.cpp Normal file
View File

@ -0,0 +1,40 @@
#include <iostream>
#include <time.h>
#include <stdlib.h>
template <class T>
void swapThem(T* a, T* b)
{
T c = *b;
*b = *a;
*a = c;
}
// a strange implementation of the fibonacci algorithm, because why not !
int main(void)
{
using bigint_t = unsigned long long int;
// setting the seed for rand
srand(static_cast<unsigned>(time(0)));
// some variables to store the fibonacci serie
bigint_t a = 1, b = 0;
// find a limit
unsigned c = 0, limit = (rand() % 30) + 10;
while (true)
{
// calculating the fibonacci serie and displaying it
a += b;
std::cout << a << " ";
swapThem(&a, &b);
c++; // so much fun ^^
if (c == limit)
break;
}
std::cout << std::endl;
return 0;
}

3
code/helloworld.php Normal file
View File

@ -0,0 +1,3 @@
<?php
echo "Hello world !";
?>