Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Deque EvenOdd
//g++ 7.4.0 #include <iostream> #include <deque> using namespace std; int main () { deque<int> d; d.push_back(1); d.push_back(2); d.push_back(3); d.push_back(4); d.push_back(5); d.push_back(6); d.push_back(7); d.push_back(8); d.push_back(9); for(int i=0;i<d.size();++i){ if(i%2==0){//print the integers on even number positions cout<<d[i]; cout <<" "; } } cout<<endl; for(int i=0;i<d.size();++i){ if(i%2!=0){//print the integers on odd number positions cout<<d[i]; cout <<" "; } } return 0; }
run
|
edit
|
history
|
help
0
a
Simple use of function templete and namespace
Pairs having sum equal to target
Teste sobrecarga de operadores
Shortest path in binary tree
memcpy
Havel Hakimi UVA-12786 Friendship Networks
Vector Example
lambda capture
Boost phoenix. e.g 2: functor