add c++11 (#87)

* binary search c++

* selection sort c++11

* c++ recursive countdown

* c++ recursion

* c++ quicksort

* rename folder names to c++11

* add another version of binary_search function

* c++11 hash tables

* c++11 breadth-first search
This commit is contained in:
umatbro
2018-10-18 17:25:54 +02:00
committed by Aditya Bhargava
parent 38f5b2792e
commit 7dc9e95d2a
15 changed files with 432 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
#include <iostream>
using std::cout;
using std::endl;
void countdown(const int& i) {
cout << i << endl;
// base case
if (i <= 0) return;\
// recursive case
countdown(i - 1);
}
int main() {
countdown(5);
}

View File

@@ -0,0 +1,27 @@
#include <iostream>
#include <string>
using std::cout;
using std::endl;
void greet2(std::string name) {
cout << "How are you, " + name + "?" << endl;
}
void bye() {
cout << "Ok, bye!" << endl;
}
void greet(std::string name) {
cout << "Hello, " + name + "!" << endl;
greet2(name);
cout << "Getting ready to say bye..." << endl;
}
int main() {
greet("Adit");
return 0;
}

View File

@@ -0,0 +1,13 @@
#include <iostream>
using std::cout;
using std::endl;
int fact(const int& x) {
if (x == 1) return 1;
return fact(x-1) * x;
}
int main() {
cout << fact(5) << endl;
}