You are on page 1of 1

#include <iostream>

#include <forward_list>

using std::cout;

using std::forward_list;

using namespace std;

void print_pos(forward_list<int>A,forward_list<int>B)

for(auto it_B= B.begin(); it_B != B.end();it_B++){

int pos = *it_B;

auto it_A = A.begin();

for(int pasos = 0; pasos < pos; pasos++){

it_A++;

cout<<*it_A <<" ";

void printLots(const list_of_int& l, const list_of_int& p) {

int count=0;

for(list_of_int::const_iterator i=l.begin(),j=p.begin();

i !=l.end();++i,++count) { if(count== *j) {

cout << *i <<' '<< endl; ++j;

int main()

forward_list<int> L{10,20,30,40,50,60,70,80,90,100,110,120,130,140,150};

forward_list<int> P{3,5,7,12,14};

print_pos(L,P);

You might also like