GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 12-Mar-2004, 01:46
beebop beebop is offline
New Member
 
Join Date: Mar 2004
Posts: 1
beebop is on a distinguished road

help with c++ vectors


I need some help using vector.h and initializing/declaring a vector and how to pass it through functions.
I don't know the correct syntax for declaring a vector in a function maybe this:

void solve(int num, vector<double> &vecA)
{

}

any help would be appreciated
thanks
  #2  
Old 12-Mar-2004, 06:03
pan pan is offline
New Member
 
Join Date: Mar 2004
Location: Greece
Posts: 16
pan will become famous soon enough

vectors


Hey,

The code you wrote is fine for passing vectors to a function. Very well done.
In terms of defining a vector, the following are the standard examples used in the STL.

To declare a vector:
CPP / C++ / C Code:
vector<int> VECTOR_NAME;

To define a vector using an array:
CPP / C++ / C Code:
int array[3] = { 1, 3, 4 };
vector<int> INTS (array, array+3 );

Hope this was helpful,
Pan Thomakos
 
 

Recent GIDBlogProblems with the Navy (Enlisted) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
C++ Vectors Katie C++ Forum 5 17-May-2004 23:36

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 22:01.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.