Search
 
SCRIPT & CODE EXAMPLE
 

CPP

how to make a list in c++

#include <list>
std::list<int> ints;
Comment

list in c++

#include <bits/stdc++.h>
using namespace std;
void display(list<int> &lst){
    list<int> :: iterator it;
    for(it = lst.begin(); it != lst.end(); it++){
         cout<<*it<<" ";
    }
}
int main(){
    list<int> list1;
    int data, size;
    cout<<"Enter the list Size ";
    cin>>size;
    for(int i = 0; i<size; i++){
        cout<<"Enter the element of the list ";
        cin>>data;
        list1.push_back(data);
    }
    cout<<endl;
    display(list1);
  return 0;
}

Comment

PREVIOUS NEXT
Code Example
Cpp :: C++ Swap 2 Variables Without Using 3rd Variable 
Cpp :: resize 2d vector c++ 
Cpp :: flags for g++ compiler 
Cpp :: c++ simple car game 
Cpp :: c++ function 
Cpp :: c++ fizzbuzz 
Cpp :: find max value in array c++ 
Cpp :: cpp ifstream 
Cpp :: primes in range cpp 
Cpp :: string iterator in c++ 
Cpp :: c++ inline in .cpp and not in header 
Cpp :: setprecision c++ 
Cpp :: convert string to lpwstr 
Cpp :: 1d array 
Cpp :: combine two vectors c++ 
Cpp :: functors in c++ 
Cpp :: c++ Sum of all the factors of a number 
Cpp :: cpp vector2 
Cpp :: c++ cstring to string 
Cpp :: char size length c++ 
Cpp :: stack implementation using class in c++ 
Cpp :: untitled goose game 
Cpp :: pointer in return function c++ 
Cpp :: classes and objects in c++ 
Cpp :: erase element from vector c++ 
Cpp :: find in vector 
Cpp :: Disabling console exit button c++ 
Cpp :: use of alphanumeric function c++, check if alphabet or digit from string 
Cpp :: joining two vectors in c++ 
Cpp :: array of Methods c++ 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =