177 Topics

Member Avatar for
Member Avatar for Lord_Migit

Hey folks, i have a problem with a vector im attempting to program. There are no compile errors but during run time i get an error saying: "Debug Assertion Failed! Program:...filepath\GA.exe File:...include\vector Line: 779 Expression: vector subscript out of range" etc... I have tried stepping throught the program to no …

Member Avatar for Fbody
0
656
Member Avatar for Nirvin M

What is the use of GDI+? Can I use it for creating custom controls to use in Vector Graphics program?

Member Avatar for lolafuertes
0
157
Member Avatar for notuserfriendly

I am reading from a file. After i tokenize and assign each value to a string field i call the constructor and initialize the object. next i want to add them to an array. I have done this with a vector and all i do is [CODE=java]ObjectVec.add(obj1);[/CODE] Mind you this …

Member Avatar for masijade
0
171
Member Avatar for aravind rao

Hi I am developing a program that uses Breadth First Search to map a grid(2d array) out. Breadth First Search involves storing nodes in a stack and then exploring these nodes based on Breadth or level. I know how to create a vector array which I shall use as a …

Member Avatar for aravind rao
0
172
Member Avatar for nirali7

Hi, I am kind of new to C++ and really stuck with a problem. Here I am trying to parse a string and after comparing to a pre-declared array save the tokens in a vector of vectors. It is giving a number of errors and I'm not sure what to …

Member Avatar for nirali7
0
2K
Member Avatar for hasrule

Hi, I was working on thread pool, which I used std::vector to implement the pool. [CODE] private: std::vector <handlerthread*> _pool; handlerthread* temp; void threadpool::addWorker() { handlerthread *temp; temp = new handlerthread(this); int x=_pool.size(); temp->start(&x); _pool.push_back(temp); } handlerthread* threadpool::getIdleWorker(){ int idx=-1; for (int i=0;i<_pool.size();i++){ temp=(handlerthread*)_pool[i]; //SIGSEGV HERE if(temp->isIdle()){ idx=i; break; } …

Member Avatar for mike_2000_17
0
685
Member Avatar for crapgarden

I have a question on Chapter 4, exercise 1 of Michael Dawson's "Beginning C++ through Game Programming 2nd Edition". The chapter goes over STL, vectors and iterators. The assignment is to create a program that allows the user to edit games in a list. In the book we learn about …

Member Avatar for mrnutty
0
329
Member Avatar for dansnyderECE

I want to represent 2^32 elements in a vector. In reality, I allocate about 500,000 elements and then everything else is there to be used by my program (for storage of data). So I have to have say.. elements: [0-999999] = 0 [100000-599999] = info [600000 +] = 0 <-really …

Member Avatar for dansnyderECE
0
158
Member Avatar for sasTReSS

Hello everyone, i have a problem in my code. I want to make 2D vector with type char and the char read from a file, because i want to make it as dynamic array regarding the size of input can be different. Here is my file: bla.txt ------------------------------ K1, K2. …

Member Avatar for sasTReSS
0
188
Member Avatar for Dows

Dear all, I'm creating a set of functions to handle stl vectors. Some are useful for achieving my goals. I'm coding some other just for fun. But after some coding I see I cannot compile them propperly. One example would be a vector print function which prints all the elements …

Member Avatar for mrnutty
0
146
Member Avatar for SacredFootball

Hey all! I'm trying to figure out how to check if an element already exists in a vector. EXAMPLE: Elements in the vector are: "Dog", "Cat", "Fish", "Bird" If a user tries to add (case ignored) "Dog", "dog" or any other variation, I want it to spit out and error …

Member Avatar for Narue
0
2K
Member Avatar for prototyppe

Having trouble trying to copy the vector 'sel' in main to vector 'ask' in class A. Can someone either explain or show me? Thanks in Advance![code]class A{ private: public: vector<Trader> ask; void AskMatchList(vector<Trader>&); void showAuct(); }; void A::AskMatchList(vector<Trader> &list){ vector<Trader>::iterator it; f1= new Trader; //I understand this is the WRONG …

Member Avatar for prototyppe
0
170
Member Avatar for gendler.max

Hi, I am writing a program for my C++ class that must create a struct(Hero) and make an array of it. My class is using the lvp library and i was wondering if anybody could help me make a vector of hero objects. This is what i have so far: …

Member Avatar for gendler.max
0
135
Member Avatar for Valter Henrique

Hi everyone, i'm new in DaniWeb, so forgive me by some mistake, x) I need create a iterator, it can receive any kind of struct of STL, like map, vector, list, ... How i do that? Someone have any idea? Thanks by your attention. Best regards, Valter Henrique.

Member Avatar for Valter Henrique
0
103
Member Avatar for braineater

Make a project, consisting of 3 modules: student.cpp, course.cpp and register.cpp. Write source and header file for a program that registers students for courses. Design a class student, that stores the name of the student , the id number and array(vector) of all course numbers for which the student is …

Member Avatar for daviddoria
-2
151
Member Avatar for phummon

Hi everyone, I'm a moderately experienced C++ programmer and a network engineer. I’m having a weird problem with using an array of vector<char *>, which I’ve never tried to work with before. I’m working on a program which does the following: 1. Inputs and parses a file called [B]PREFIX_FILE[/B], which …

Member Avatar for daviddoria
0
201
Member Avatar for Annettest

Hello everyone: I'm having a problem with vector indexing. The following code results in a segmentation fault: [CODE] for (int i = 0; i < (rows * rows); i++) { temperature[(i * rows) + (rows - 1)] = 0; }[/CODE] And: [CODE] for (int i = 0; i < (rows …

Member Avatar for Annettest
0
191
Member Avatar for Annettest

Hello everyone: I am a C++ newbie. I have used Matlab to fill the rows or columns of a matrix with values from a vector and I'm wondering how to do the same thing in C++... I have written code that puts new values in a vector. This happens in …

Member Avatar for Lerner
0
238
Member Avatar for NEMESISD

Hi, I've been trying to catch up on my class and pointer code (both are weak areas for me at the moment). I tried researching as much of the code as possible and getting some in-class help, **Edit Changed program, no longer gives build error**. This is designed to take …

Member Avatar for NEMESISD
0
245
Member Avatar for habib_parisa

Dear all, I am trying to understand a C++ code. In one part of the code a one dimensional vector is copied into a two dimensional vector. I do not understand at all how such thing can work. But compiler is quite ok with that. #define TOTAL_STEPS 120 #define NUMBER_DECISION_VARIABLES …

Member Avatar for habib_parisa
1
1K
Member Avatar for tom384

Hi guys, I'm having trouble using a pointer to a vector<float>, it doesn't seems to be responding as I'm expecting it to. Probably a silly mistake on my behalf, but would anyone kindly point it out please. [code] vector<float>* t_matrix; ... cout << "get_t_matrices 0: " << Character::anim.get_animations()[j].get_t_matrices()[0].size() << endl; …

Member Avatar for mattjbond
0
189
Member Avatar for parisa_bala

I am a C programmer. I am working on a C++ code and translating it into C. I got stuck in a point where I do not understand what is going on. I would kindly ask if you would mine help me to understand these problems. I have three problems: …

Member Avatar for Narue
0
197
Member Avatar for tnclark8012

Hey everyone, I'm having an issue with the simplest vector functions. I'm trying to add a Piece object to a vector, but it's data members are being changed when I do... am I missing something? [CODE] /* Piece.h */ #ifndef _PIECE_H #define _PIECE_H class Piece { public: Piece(); Piece(int r, …

Member Avatar for tnclark8012
0
166
Member Avatar for cog_bn

Hi, I've got a problem with a program that boils down to strange behavior by the vector container class. It seems to not want to call constructors enough but calls destructors too many times: [CODE] #include <vector> #include <iostream> using std::cout; int constructor_count=1,destructor_count=1; class obj{public: obj(){ cout<<"C: "<<constructor_count++<<'\n'; } ~obj(){ …

Member Avatar for vijayan121
0
625
Member Avatar for necrolin

If I have 2 classes a) class Business b) class Customer I want the Business class to be able to store a dynamic list of it's customers. So I thought the easiest way to do this would be to use a vector. [code] class Business { vector<Customer> customers; public: Business(); …

Member Avatar for necrolin
0
197
Member Avatar for markrezak

[CODE]ok ok i got it now right i copy it to vector and sort it..... here is the code #include <iostream> #include <fstream> #include <algorithm> #include <string> #include <map> #include <vector> using namespace std; typedef map<string,int> word_count_list; struct val_lessthan : binary_function < pair<string,int>, pair<string,int>, bool > { bool operator() (const …

Member Avatar for markrezak
0
269
Member Avatar for markrezak

ok ok i got it now right i copy it to vector and sort it..... here is the code #include <iostream> #include <fstream> #include <algorithm> #include <string> #include <map> #include <vector> using namespace std; typedef map<string,int> word_count_list; struct val_lessthan : binary_function < pair<string,int>, pair<string,int>, bool > { bool operator() (const …

Member Avatar for William Hemsworth
0
174

The End.