• Martin Thoma
  • Home
  • Categories
  • Tags
  • Archives
  • Support me

Recent Posts

Maps in C++

Maps in C++

Maps are one of the most useful datastructures in C++ and there is no excuse for not knowing it. Here is a basic example that shows how you can use it: #include // cout #include #include using namespace std; int main() { map phonebook; // Put some stuff … Read More »
Vectors in C++

Vectors in C++

Minimal Example #include #include #include using namespace std; int main() { // create an empty vector vector myVector; // insert one element myVector.push_back(5); // insert another element myVector.push_back(4); // insert more elements myVector.push_back(1337); myVector.push_back(42); myVector.push_back(31415); // insert an element which was there … Read More »
Sets in C++

Sets in C++

#include #include #include using namespace std; int main() { // create an empty set of integers set mySet; // insert one element mySet.insert(5); // insert another element mySet.insert(4); // insert more elements mySet.insert(1337); mySet.insert(42); mySet.insert(31415); // insert an element which was there … Read More »
Stacks in C++

Stacks in C++

Minimum Example #include #include using namespace std; int main(){ stack myStack; myStack.push(5); cout << "Size of stack: " << myStack.size() << endl; myStack.push(4); // get the element on the top cout << "Top: " << myStack.top() << endl; // it does NOT automatically pop! cout << "Top: " << myStack.top() << endl; // pop has … Read More »
  • Martin Thoma - A blog about Code, the Web and Cyberculture
  • E-mail subscription
  • RSS-Feed
  • Privacy/Datenschutzerklärung
  • Impressum
  • Powered by Pelican. Theme: Elegant by Talha Mansoor