What do you want to save?
Add Code snippet
New code examples in category C++
-
Krish 2022-03-27 21:20:39
lists occurrences of characters in the string c++
int d[27]={0}; for (int i = 0; i < str.length(); i++) //AABBCC d[str[i] - 'A']++; for (int i = 0; i < str.length(); i++) if (d[str[i] - 'A'] != 0) { cout << str[i] << " "<< d[str[i] - 'A'] << " "; /... Add solution -
Awgiedawgie 2022-03-27 17:40:12
C++ pointer to base class
#include <cstdlib> #include <ctime> #include <iostream> #include <vector> class Parent { public: virtual void sayHi() { std::cout << "Parent here!" << std::endl; } }; class Child : public... Add solution -
Phoenix Logan 2022-03-27 14:15:21
find the graph is minimal spanig tree or not
#include <iostream> #include <vector> #include <utility> #include <algorithm> using namespace std; const int MAX = 1e4 + 5; int id[MAX], nodes, edges; pair <long long, pair<int, int> > p[MAX]; void initialize() { ... Add solution -
Rubixphys12 2022-03-27 13:30:15
multi variable assignment cpp
int x = 5, y = 6, z = 50; Add solution -
-
Awgiedawgie 2022-03-27 12:20:12
why exceptions can lead to memory leaks
//If an exception is raised between allocation and deallocation, memory leak will occur. void f1() { int* ptr = new int; // do something which may throw an exception // we never get here if an exception is thrown delete ptr; } Add solution
Best helpers
Ranking is empty