STL Based Vector Collection
Understand the usage of vector collection for storing user-defined Point class objects.
We'll cover the following
Problem
Write a program to maintain a collection of objects of a user-defined Point
class.
Sample run
Here’s what you should see when you run the program.
Vector vp1:
x, y = 1, 1
x, y = 2, 2
x, y = 3, 3
x, y = 4, 4
x, y = 5, 5
Front: x, y = 1, 1
Back : x, y = 5, 5
Reverse Vector vp1:
x, y = 5, 5
x, y = 4, 4
x, y = 3, 3
x, y = 2, 2
x, y = 1, 1
Sizeof vp1 : 5
Vector vp2:
x, y = 1, 1
x, y = 2, 2
x, y = 3, 3
Coding solution
The following code widget has the solution for the challenge explained above.
Get hands-on with 1400+ tech skills courses.