What do you want to save?
Add Code snippet
New code examples
-
C++ 2021-11-13 06:28:15
c++ split string by comma into array
#include <vector> #include <string> #include <sstream> #include <iostream> using namespace std; int main() { string s="i,love,my,country,very,much"; //declare a string string answer[6]; // string array to stor... Add solution -
Other 2021-11-12 23:17:23
gcc to windows
#include <iostream> #include <vector> #include <string> using namespace std; int main() { vector<string> msg {"Hello", "C++", "World", "from", "VS Code", "and the C++ ext... Add solution -
C++ 2021-11-11 09:35:16
emplace_back vector c++
// vector::emplace_back #include <iostream> #include <vector> int main () { std::vector<int> myvector = {10,20,30}; myvector.emplace_back (100); myvector.emplace_back (200); std::cout << "myvector contains:"; ... Add solution -
C++ 2021-11-10 19:58:11
how to use vectors c++
#include <iostream> #include <vector> using namespace std; int main() { //vector element size const int size = 4; //vector with int data type //all elements are equal to 4 vector<int> myVect (size, 4); for (int i=0; i<s... Add solution -
C++ 2021-11-10 13:28:17
how to find a integer is how many times repeated in C++ without for loop
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(void) { vector<int> v = {1, 3, 3, 3, 3}; int cnt; cnt = count(v.begin(), v.end(), 3); cout << "Number 3 occurs &quo... Add solution -
TypeScript 2021-11-07 09:17:14
make a vector of an objects c++
#include <vector> using std::vector; class MyClass { .... }; vector<MyClass> myVector( 100, MyClass() ); /* myVector now contains 100 objects of type MyClass, built with the default constructor */ vector<MyClass> myVector2; // MyVecto... Add solution