"<vectors>"

A

and.280.c

Hello News-Group
what are the vectors
why and how we use them into "C++" Program
are the vector's "Array" or Containers ???
and how can we asign the value to the "<vector>"
 
A

Alf P. Steinbach

* (e-mail address removed):
Hello News-Group
what are the vectors

Presumably you mean std::vector. It a standard library container class
that provides the functionality of dynamically sized array. You can
find more about it in any decent C++ textbook.

why and how we use them into "C++" Program

#include <vector>
#include <iostream>
#include <ostream>

int main()
{
using namespace std;
vector<int> v;
v.push_back( 1 ); v.push_back( 2 ); v.push_back( 3 );
for( size_t i = 0; i < v.size(); ++i )
{
cout << v << endl;
}
}

are the vector's "Array" or Containers ???
Yes.


and how can we asign the value to the "<vector>"

Give an example of what you mean.

Chances are that that example will work.
 
B

Barry

Hello News-Group
what are the vectors
why and how we use them into "C++" Program
are the vector's "Array" or Containers ???
and how can we asign the value to the "<vector>"
vector is a *Container* works like an *Array*

How and why use vector, I think you better check it out in a textbook
 
B

BobR

Hello News-Group
what are the vectors
why and how we use them into "C++" Program
are the vector's "Array" or Containers ???
and how can we asign the value to the "<vector>"

If you will READ this NG, you will find many examples of 'std::vector'.

FAQ http://www.parashift.com/c++-faq-lite

Get "Thinking in C++", 2nd ed. Volume 1&2 by Bruce Eckel
(available for free here. You can buy it in hardcopy too.):
http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html

Dinkumware site:
http://www.dinkumware.com/manuals/.
 
M

Mike Wahler

Hello News-Group
what are the vectors

The type 'std::vector' is one of several
container types provided by the C++ standard
library. It models a dynamically sizable array.

Use them if you want to store a collection of the
same type objects.
and how we use them into "C++" Program

Define a std::vector object, and use its member
functions to manipulate it. More specific details
are available in any good C++ text. See the reviews
at www.accu.org for recommendations.
are the vector's "Array" or Containers ???

See above.
and how can we asign the value to the "<vector>"

You can't. A vector can store zero or more objects
of the same type. Each of those objects would have
a value. The vector object itself doesn't have a
(meaningful) 'value'.

Get some books. Others have already mentioned the
C++ FAQ. Read that too.

-Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top