What do you want to save?
Add Code snippet
New code examples
-
C++ 2022-03-18 22:30:02
c++ vector insert time complexity
// inserting into a vector #include <iostream> #include <vector> int main () { std::vector<int> myvector (3,100); std::vector<int>::iterator it; it = myvector.begin(); it = myvector.insert ( it , 200 ); myvector.insert... Add solution -
C++ 2022-03-16 14:00:05
how to remove an element from a vector by value c++
#include <algorithm> #include <vector> // using the erase-remove idiom std::vector<int> vec {2, 4, 6, 8}; int value = 8 // value to be removed vec.erase(std::remove(vec.begin(), vec.end(), value), vec.end()); Add solution -
C++ 2022-03-06 18:00:01
initialize vector of vector c++
#include <iostream> #include <vector> #define M 3 #define N 4 int main() { // specify default value to fill the vector elements int default_value = 1; // first initialize a vector of ints with given default value std::vec... Add solution -
C++ 2022-03-03 02:35:02
c++ string to vector int
#include <sstream> #include <vector> #include <string> std::string myString = "10 15 20 23"; std::stringstream iss( myString ); int number; std::vector<int> myNumbers; while ( iss >> number ) myNumbers.push_back... Add solution -
C++ 2022-03-02 02:10:08
c++ remove class from vector
#include <algorithm> #include <vector> #include <iostream> class MyClass { public: std::string Name; }; std::vector<MyClass> MyClass_Vector; int main() { MyClass myclass_1; MyClass myclass_2; MyClass myclass_... Add solution -
Best helpers
Ranking is empty