#include<vector>
#include<iostream>
#include<algorithm>
using namespace std;
int F()
{
static int count = 1;
count = count *5;
return count;
}
void main()
{
vector<int>V(5,0);
vector<int>::iterator i1;
for(i1=V.begin(); i1<V.end(); i1++)
{
cout<<*i1<<" ";
}
generate(V.begin(), V.end(), F);
cout<<"\nAfter calling generate" <<endl;
for(i1=V.begin(); i1<V.end();i1++)
{
cout<<*i1<<" ":
}
}
Home       |      About Us       |     Portfolio       |      Services       |       Career        |    Contact Us       |      Industrial Training        |      Achievement 
Corporate Services
  Web Design and development
  Web Promotion (SEO)
  Multimedia/CD Presentation
  Software development

  E.Commerce

Training@balujalabs

  Software Courses
  Hardware Courses
  Networking.Courses
  Mobile Repairing Courses
  UGC Degrees
Student Corner
 Programming & Projects
 Placement Papers
 Project Ideas
 Synopsis Ideas

  Franchise Section

 Administrator
Franchise Inquiry
 
 

Illustrates generates () function.

 

 

 

 

 

 

 

 

 

                                                                                                                                          

1 Illustrates push_back, pop_back () size () and empty member function.
2 Illustrates swap (), resize (), capacity () and max_size () member functions of the vector container. It also illustrates the difference between size () and capacity () member functions. The difference between size () and capacity () function is illustrated in the following figure.
3 Illustrates begin () and end () member functions.
4
Illustrates erase () and insert() member functions if the vector container. The program also uses ostream_iterator, copy () functions of the algorithm header file. Ostream_iterator is another adaptor which provides output iterator functionality and will write the data out. The ostream_iterator constructortakes two arguments, the stream to be used and the separator. It prints the separator between elements the syntax is: ostream_iterator<int>out(vout.””); copy() is a function of the algorithm header file which can be used with any of the containers. The other function of the algorithm header file are discussed at the end of the chapter, copy() function helps in copying a sequence. It has three arguments. The first two arguments denote the beginning and the end of the sequence to be copied and the third argument gives the destination. For example the command. Copy(v.begin(),v.end()(,out); display the elements of the vector form the beginning till the end. Find () is another function of the algorithm header file which searches a ranges for a value and returns an iterator to the first occurrence of the elements
5 Illustrates two types of insert() and erase() member function it also uses.
6 Illustrates front (), rbeggin and rend () member functions
7 To illustrate the stack member functions push(), pop(), top() and empty() in a stack of integers
8 Illustrates stack member functions in a stack of stings.
9 To illustrate push_back(), pop_frond(), front() and size() member functions of the list container.
10 Illustrates push_fron() and pop_back() member functions.
11 Illustrates remove() and reverse() member functions.
12 Illustrates sor() and merge() member functions.
13 To illustrate traversing of the linked list using aerators.
14 Illustrates insert() and erase() member functions using iterators.
15 Illustrates deque member functions, functions push_front(), push_back(), pop_front, pop_back() and insert() member functions.
16 To illustrate swapping of two deques.
17 Illustrates pop(), push() and front() member functions.
18 Illustrates sort(), binary_serar(), lower_bound() and upper_bound() functions.
19 Illustrates count() functions.
20 Illustrates generates () function.
21 Illustrates the use of generate_n() function.
22 Illustrates includes () functions.
23 Illustrates partition () function.
24 Illustrates remove() and replace() member functions.
25 Illustrates search() and distance() functions.
26 The following program displays the occurrence of the repeated set of elements in a vector container. The program illustrates search_n () and distance() function.
27 Square the elements of an array using transform() function.
28 make_heap(first, last);: Converts the range given by first to last into a heap sort_heap(first,last);: This turns a heap(first,last) into assorted range.
29 To illustrate sort_heap () and make_heap() member function for heapifying the elements of a vector.
30
31

 

 

     
Home       |      About Us       |     Portfolio       |      Services       |       Career        |    Contact Us       |      Industrial Training        |      Achievement