What do you want to save?
Add Code snippet
New code examples in category C++
-
A-312 2022-03-15 06:55:06
segment tree complexity
// C++ program to show segment tree operations like construction, query // and update #include <bits/stdc++.h> using namespace std; // A utility function to get the middle index from corner indexes. int getMid(int s, int e) { return s + (e -s)... Add solution -
Awgiedawgie 2022-03-15 04:15:12
c++ void to avoid functions
/*The following example collects user data and formats it using seperate void statements */ #include <iostream> #include <string> #include <stdio.h> #include <stdlib.h> using namespace std; // function declarations void inputData... Add solution -
Awgiedawgie 2022-03-14 13:40:01
get current date in c++
#include <ctime> #include <iostream> int main() { std::time_t t = std::time(0); // get time now std::tm* now = std::localtime(&t); std::cout << (now->tm_year + 1900) << '-' << (now->tm_mon +... Add solution -
Awgiedawgie 2022-03-14 13:05:03
assert c++
assert(std::is_same_v<int, int>); // error: assert does not take two arguments assert((std::is_same_v<int, int>)); // OK: one argument static_assert(std::is_same_v<int, int>); // OK: not a macro std::complex<double> c; assert(c == ... Add solution -
Awgiedawgie 2022-03-14 07:05:04
constant variables in c++
// various versions of const are explained below #include <iostream> class Entity { private: int m_X, m_Y; mutable int var; // can be modified inside const menthods int* m_x, *m_y;// * use to create pointer in one line public: int GetX() const /... Add solution -
Awgiedawgie 2022-03-13 06:15:02
static inside local scope in c++
#include<iostream> //Singleton class is a class having only one instance class SingleTon { public: static SingleTon& Get() { static SingleTon s_Instance; return s_Instance; }//there is only one instance of static functions and variables a... Add solution -
Phoenix Logan 2022-03-13 03:35:20
how to check private messages on reddit
if (Input.GetKeyDown) Add solution
Best helpers
Ranking is empty