Click here to Skip to main content
15,920,633 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: C++ question Pin
DavidNohejl11-Sep-05 8:15
DavidNohejl11-Sep-05 8:15 
GeneralRe: C++ question Pin
Marc Clifton11-Sep-05 8:06
mvaMarc Clifton11-Sep-05 8:06 
GeneralRe: C++ question Pin
nde_plume11-Sep-05 11:42
nde_plume11-Sep-05 11:42 
GeneralRe: C++ question Pin
Marc Clifton11-Sep-05 12:02
mvaMarc Clifton11-Sep-05 12:02 
GeneralRe: C++ question Pin
nde_plume11-Sep-05 14:15
nde_plume11-Sep-05 14:15 
GeneralRe: C++ question Pin
Marc Clifton11-Sep-05 15:30
mvaMarc Clifton11-Sep-05 15:30 
GeneralRe: C++ question Pin
Jim Crafton11-Sep-05 8:43
Jim Crafton11-Sep-05 8:43 
GeneralRe: C++ question Pin
Christian Graus11-Sep-05 12:45
protectorChristian Graus11-Sep-05 12:45 
Not sure at the end of the day if you feel your question has been answered. The answer is std::vector. Put #include <vector> at the top of your code, and then using std::vector just below. Then in your code you define a vector like this vector<type> = name; For example

#include <vector>
#include <string>

using std::vector;
using std::string;

int main()
{
vector<int> vecInt;
vector<string> vecString;

vecInt.push_back(1);
vecInt.push_back(2341);
vecInt.push_back(341);
vecInt.push_back(176);

vecString.push_back("fsdfsdfdf");
vecString.push_back("fgkkf");
vecString.push_back("45j4");

// Now this is how we use it

vector<int>::iterator begin = vecInt.begin();

int total = 0;

for(;begin != vecInt.end();++it)
{
total += *begin; // You need to dereference the iterator to get the value.
}

// You could also use the algorithm in <algorithm> to do stuff like this.
}

Christian Graus - Microsoft MVP - C++
GeneralRe: C++ question Pin
David Crow12-Sep-05 4:20
David Crow12-Sep-05 4:20 
GeneralRe: C++ question Pin
Anonymous12-Sep-05 5:37
Anonymous12-Sep-05 5:37 
GeneralRe: C++ question Pin
Sveta8012-Sep-05 5:41
Sveta8012-Sep-05 5:41 
GeneralRe: C++ question Pin
David Crow12-Sep-05 6:20
David Crow12-Sep-05 6:20 
QuestionRedrawing problems Pin
dudeua11-Sep-05 6:19
dudeua11-Sep-05 6:19 
AnswerRe: Redrawing problems Pin
PJ Arends11-Sep-05 10:12
professionalPJ Arends11-Sep-05 10:12 
GeneralRe: Redrawing problems Pin
dudeua11-Sep-05 10:44
dudeua11-Sep-05 10:44 
Questionproblem with fstream Pin
Member 224774911-Sep-05 3:24
Member 224774911-Sep-05 3:24 
QuestionHow to set the BackGround color of a window? Pin
eli1502197911-Sep-05 1:09
eli1502197911-Sep-05 1:09 
AnswerRe: How to set the BackGround color of a window? Pin
ThiefXXX11-Sep-05 11:16
ThiefXXX11-Sep-05 11:16 
AnswerRe: How to set the BackGround color of a window? Pin
Mircea Puiu12-Sep-05 4:40
Mircea Puiu12-Sep-05 4:40 
Questiontextbox Pin
lallaba10-Sep-05 23:26
lallaba10-Sep-05 23:26 
AnswerRe: textbox Pin
Mohammed F. Salem11-Sep-05 7:42
Mohammed F. Salem11-Sep-05 7:42 
QuestionColor map Pin
Ta Xuan Hung10-Sep-05 22:55
Ta Xuan Hung10-Sep-05 22:55 
AnswerRe: Color map Pin
Branislav12-Sep-05 0:54
Branislav12-Sep-05 0:54 
QuestionPutting a Large Icon in an MFC dialog box Pin
nde_plume10-Sep-05 21:27
nde_plume10-Sep-05 21:27 
QuestionXmlDocument: Retrieving validation file Pin
picazo10-Sep-05 14:57
picazo10-Sep-05 14:57 

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.