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
Default copy
Height of a binary tree
cache 内存消耗
The Menu
articulation points and bridges
pointer array of functions
Aiutttt
Address Book
Tree
Roots of a Quadratic Equation