What do you want to save?
Add Code snippet
New code examples in category C++
-
Awgiedawgie 2022-03-16 14:50:10
array header, <array>
#include <iostream> #include <array> using namespace std; int main() { array<int,3> myarray {10,20,30}; for (int i=0; i<myarray.size(); ++i) ++myarray[i]; for (int elem : myarray) cout << elem << '\n'; } Add solution -
Phoenix Logan 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 -
Awgiedawgie 2022-03-16 10:10:02
getline cpp
// extract to string #include <iostream> #include <string> int main () { std::string name; std::cout << "Please, enter your full name: "; std::getline (std::cin,name); std::cout << "Hello, " << n... Add solution
Best helpers
Tushar Diwan
+5
Pinakin
+5
I-love-php
+5
Sinow
+5
Saforrest
+5
Mastersulm
+5
Adam Clowes
+5
RiCo
+5
Any Mouse
+5
Richard D
+5