mirror of
https://github.com/c0de-archive/hacktoberfest-2018.git
synced 2024-12-22 05:12:40 +00:00
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:
parent
f357770592
commit
f0c0410eb6
40
code/do_strange_stuff.cpp
Normal file
40
code/do_strange_stuff.cpp
Normal 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
3
code/helloworld.php
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<?php
|
||||||
|
echo "Hello world !";
|
||||||
|
?>
|
Loading…
Reference in New Issue
Block a user