What do you want to save?
Add Code snippet
New code examples
-
C++ 2021-11-20 01:46:17
vector functions c++
#include <vector> std::vector<std::string> x; Add solution -
C++ 2021-11-19 17:27:22
variable sized array
#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> //using namespace std; int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int n; ... Add solution -
C++ 2021-11-19 14:25:09
how to get a random element from a vector c++ string
#include <iostream> #include <vector> using std::string; int main() { std::vector <string> some_vector {"pizza", "burger", "fries", "chicken"}; string random = some_vector[rand() % some_v... Add solution -
C++ 2021-11-16 00:00:19
C++ cin cout
//it_start and it_end are the start and end iterators of your container //(ie. vec.begin() and vec.end()) //T is the type of your container (for example, for a std::vector<int> then //T is int) //separator is a string that will be inserted between e... Add solution -
C++ 2021-11-14 13:30:21
c++ print vector without loop
template <typename T> std::ostream& operator<< (std::ostream& out, const std::vector<T>& v) { if ( !v.empty() ) { out << '['; std::copy (v.begin(), v.end(), std::ostream_iterator<T>(out, ", "))... Add solution -
C++ 2021-11-13 07:45:32
priority queue descending order c++
// using GCC 10.2 (C++2a) compiler #include <functional> #include <queue> #include <vector> #include <iostream> template<typename T> void print_queue(T& q) { while(!q.empty()) { std::cout << q.top() &l... 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