lisy stl C++
C++
#include <iostream>
#include <list>
#include <iterator>
using namespace std;
//function for printing the elements in a list
void showlist(list <int> g)
{
list <int> :: iterator it;
for(it = g.begin(); it != g.end(); ++it)
cout << '\t' << *it;
cout << '\n';
}
int main()
{
list <int> gqlist1, gqlist2;
for (int i = 0; i < 10; ++i)
{
gqlist1.push_back(i * 2);
gqlist2.push_front(i * 3);
}
cout << "\nList 1 (gqlist1) is : ";
showlist(gqlist1);
cout << "\nList 2 (gqlist2) is : ";
showlist(gqlist2);
cout << "\ngqlist1.front() : " << gqlist1.front();
cout << "\ngqlist1.back() : " << gqlist1.back();
cout << "\ngqlist1.pop_front() : ";
gqlist1.pop_front();
showlist(gqlist1);
cout << "\ngqlist2.pop_back() : ";
gqlist2.pop_back();
showlist(gqlist2);
cout << "\ngqlist1.reverse() : ";
gqlist1.reverse();
showlist(gqlist1);
cout << "\ngqlist2.sort(): ";
gqlist2.sort();
showlist(gqlist2);
return 0;
}
Also in C++:
- Title
- declaring vector c++
- Category
- C++
- Title
- initialize int c++
- Category
- C++
- Title
- how to declare a vector in c++
- Category
- C++
- Title
- lisy stl C++
- Category
- C++
- Title
- random number in c++
- Category
- C++
- Title
- how to make string get spaces c++
- Category
- C++
- Title
- input a string in c++
- Category
- C++
- Title
- how to make a 2d vector in c++
- Category
- C++
- Title
- c++ ambigous error
- Category
- C++
- Title
- graph using djacency matrix c++
- Category
- C++
- Title
- call by reference c++ example
- Category
- C++
- Title
- do while loop c++
- Category
- C++
- Title
- c++ yes no question
- Category
- C++
- Title
- min heap declaration in c++ stl
- Category
- C++
- Title
- time function c++
- Category
- C++
- Title
- c++ string to stream
- Category
- C++
- Title
- c++ constructor
- Category
- C++
- Title
- All palindromic substrings
- Category
- C++
- Title
- c++ menu selection with arrow keys
- Category
- C++
- Title
- empty string c++ value
- Category
- C++
- Title
- kruskal's algorithm c++ hackerearth
- Category
- C++
- Title
- for c++
- Category
- C++
- Title
- caesar cipher program in c++
- Category
- C++
- Title
- how the theam are store in database
- Category
- C++
- Title
- c++ get length of array
- Category
- C++
- Title
- c++ function return array
- Category
- C++
- Title
- c++ string
- Category
- C++
- Title
- how to compare lower case character to uppercase cpp
- Category
- C++
- Title
- pow c++
- Category
- C++
- Title
- what is order in of preeendence in float, int, char, bool
- Category
- C++
- Title
- cube mapping sdl
- Category
- C++
- Title
- namespace file linking c++
- Category
- C++
- Title
- how to remove maximum number of characters in c++ cin,ignore
- Category
- C++
- Title
- map arduino
- Category
- C++
- Title
- jump to case label c++
- Category
- C++
- Title
- calling by reference c++
- Category
- C++
- Title
- c++ main function
- Category
- C++
- Title
- c++ delet from memory
- Category
- C++
- Title
- set mimetype validation in mongoose
- Category
- C++
- Title
- matrix multiplication c++ eigen
- Category
- C++
- Title
- Runtime Error: Runtime ErrorBad memory access (SIGBUS)
- Category
- C++
- Title
- string to vector c++
- Category
- C++
- Title
- how to sort in descending order c++
- Category
- C++
- Title
- remove from unordered_set c++
- Category
- C++
- Title
- merge sort in c++
- Category
- C++
- Title
- sorting of array in c++
- Category
- C++
- Title
- factorion
- Category
- C++
- Title
- Runtime Error: Runtime ErrorAbort signal from abort(3) (SIGABRT)
- Category
- C++
- Title
- file format not recognized treating as linker script c++
- Category
- C++
- Title
- c++ compare char
- Category
- C++
- Title
- create a bitset of 1024 bits,
- Category
- C++
- Title
- is TLE means my code is correct but taking more time to computr
- Category
- C++
- Title
- length of array in cpp
- Category
- C++
- Title
- maximum possible number atmost k swaps
- Category
- C++
- Title
- what is difference between ciel and floor
- Category
- C++
- Title
- how to have a queue as a parameter in c++
- Category
- C++
- Title
- c++ functions
- Category
- C++
- Title
- c++ char print width
- Category
- C++
- Title
- c++ initialize a vector
- Category
- C++
- Title
- memset c++
- Category
- C++
- Title
- c++ typeid get type name
- Category
- C++
- Title
- c++ pi
- Category
- C++
- Title
- c++ parse int
- Category
- C++
- Title
- sort a pair using c++ stl
- Category
- C++
- Title
- : error: ‘cont’ cannot be used as a function return (cont(cont-1))/2;
- Category
- C++
- Title
- c++ formatting
- Category
- C++
- Title
- how print fload wiht 3 decimal in c++
- Category
- C++
- Title
- check if key exists in map c++
- Category
- C++
- Title
- std string find character c++
- Category
- C++
- Title
- calculate factorial
- Category
- C++
- Title
- findung the mode in c++
- Category
- C++
- Title
- self in c++
- Category
- C++
- Title
- vector initialization c++
- Category
- C++
- Title
- set of vectors c++
- Category
- C++
- Title
- c++ do while loop
- Category
- C++
- Title
- uepic games github
- Category
- C++
- Title
- c++ random
- Category
- C++
- Title
- c++ do you not inherit constructor
- Category
- C++
- Title
- newline in c++
- Category
- C++
- Title
- first prime numbers
- Category
- C++
- Title
- run cmd command c++
- Category
- C++
- Title
- how to sort an array according to another array c++
- Category
- C++
- Title
- comparing strings c++
- Category
- C++
- Title
- how can make string value in cpp
- Category
- C++
- Title
- c++ transform
- Category
- C++
- Title
- decimal to hex cpp
- Category
- C++
- Title
- *min_element in c++
- Category
- C++
- Title
- vector of string in c++
- Category
- C++
- Title
- basic cpp programs
- Category
- C++
- Title
- write to file in C++
- Category
- C++
- Title
- centos7 mlock2
- Category
- C++
- Title
- c++ char print align
- Category
- C++
- Title
- const in c++
- Category
- C++
- Title
- length of 2d array c++
- Category
- C++
- Title
- c++ initialize array
- Category
- C++
- Title
- sieve of eratosthenes c++
- Category
- C++
- Title
- c++ sql
- Category
- C++
- Title
- cloud hosting
- Category
- C++
- Title
- initialize vector of vector c++
- Category
- C++
- Title
- multiset c++
- Category
- C++