Click here to Skip to main content
16,011,849 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Map Network Drives in Borland c++ Pin
David Crow1-Jan-06 9:10
David Crow1-Jan-06 9:10 
QuestionKillFocus Pin
ArielR29-Dec-05 1:10
ArielR29-Dec-05 1:10 
AnswerRe: KillFocus Pin
khan++29-Dec-05 1:36
khan++29-Dec-05 1:36 
GeneralRe: KillFocus Pin
ArielR29-Dec-05 4:29
ArielR29-Dec-05 4:29 
GeneralRe: KillFocus Pin
Owner drawn29-Dec-05 16:48
Owner drawn29-Dec-05 16:48 
GeneralRe: KillFocus Pin
ArielR29-Dec-05 23:43
ArielR29-Dec-05 23:43 
QuestionContainer Classes Pin
vikas amin29-Dec-05 1:05
vikas amin29-Dec-05 1:05 
AnswerRe: Container Classes Pin
ddmcr29-Dec-05 1:34
ddmcr29-Dec-05 1:34 
Here is a little example of class vector-s usage

do not forget to #include < vector >

...
//Declare function printVector
template <class T>
void printVector(const std::vector< T > &integers2);

int _tmain(int argc, _TCHAR* argv[])
{
	
	//Declare vector
	std::vector< int > integers;

	//Print some details
	cout<<"First size of array  - integers : "<<integers.size();

	//Add elements to the end
	integers.push_back(2);
	integers.push_back(3);	
	integers.push_back(4);

	//Straight access
	integers[1] = 7;

	//Remove last Element
	integers.pop_back();

	//Print Elements of 'integer'
	cout<<"\nElements of - integers in normal order : ";
	printVector(integers);

	cout<<endl;
	
	return 0;
}

//Definition of printVector
template < class T >
void printVector(const std::vector< T > &integers2)
{
	for(int i = 0;i< integers2.size();i++)
		cout<<integers2[i]<<" ";

//You could use iterators  here also , look in MSDN
}

...


Look in MSDN for details.
See deque and list classes also

Look here also



"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill





-- modified at 7:55 Thursday 29th December, 2005

GeneralRe: Container Classes Pin
vikas amin29-Dec-05 1:56
vikas amin29-Dec-05 1:56 
GeneralRe: Container Classes Pin
ddmcr29-Dec-05 2:19
ddmcr29-Dec-05 2:19 
GeneralRe: Container Classes Pin
vikas amin29-Dec-05 2:54
vikas amin29-Dec-05 2:54 
GeneralRe: Container Classes Pin
ddmcr29-Dec-05 3:02
ddmcr29-Dec-05 3:02 
Questionwhich is the Best book for 'C' Pin
Eytukan28-Dec-05 22:59
Eytukan28-Dec-05 22:59 
AnswerRe: which is the Best book for 'C' Pin
Owner drawn28-Dec-05 23:04
Owner drawn28-Dec-05 23:04 
AnswerRe: which is the Best book for 'C' Pin
navvara the infantryman28-Dec-05 23:20
navvara the infantryman28-Dec-05 23:20 
JokeOT- :) Pin
Owner drawn28-Dec-05 23:59
Owner drawn28-Dec-05 23:59 
GeneralRe: OT- :) Pin
navvara the infantryman29-Dec-05 0:04
navvara the infantryman29-Dec-05 0:04 
GeneralRe: OT- :) Pin
Owner drawn29-Dec-05 0:12
Owner drawn29-Dec-05 0:12 
GeneralRe: OT- :) Pin
navvara the infantryman29-Dec-05 0:18
navvara the infantryman29-Dec-05 0:18 
GeneralRe: OT- :) Pin
Owner drawn29-Dec-05 0:37
Owner drawn29-Dec-05 0:37 
GeneralRe: OT- :) Pin
Eytukan29-Dec-05 0:23
Eytukan29-Dec-05 0:23 
AnswerRe: which is the Best book for 'C' Pin
ddmcr29-Dec-05 1:06
ddmcr29-Dec-05 1:06 
GeneralRe: which is the Best book for 'C' Pin
Eytukan29-Dec-05 1:13
Eytukan29-Dec-05 1:13 
GeneralRe: which is the Best book for 'C' Pin
ThatsAlok29-Dec-05 1:35
ThatsAlok29-Dec-05 1:35 
GeneralRe: which is the Best book for 'C' Pin
sunit529-Dec-05 1:44
sunit529-Dec-05 1:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.