Member Avatar
... Two classes defined above. Now I want to create a vector of type ... further I want to use the vector features using the vector container. How i can create a vector container having two class objects ? please help me.
by prahesh in Software Development ()
Member Avatar
For my own use, I'd like to develop a small Vector and a Matrix class, independent of some big libraries that exist out there. My question is: Should Vector and Matrix stay two independent entities or should I derive a Vctor frm a Matrix or a Matrix from a Vector? …
by ddanbe 2,372 in Software Development ()
Member Avatar
vector<vector<double>> v2d(2, vector<double>(3,0.0)); How later on reset all elements to 0.0?. How to clear vec entirely?. Are there any performance degradation in using vector arrays verus conventionl arrays using new or malloc?.. What can be done to minize such degradation if any?.
by guest3 in Software Development ()
Member Avatar
Can you tell me what's wrong with it because it's not running on visual studio and I need it right now??? ...
by DS9596 in Software Development ()
Member Avatar
Guys, In below code after reading string values from vector , I can have output like("VarID","flag","count") All are (varID,flag and count)are string literal , now i need to populate the structre with this string literal. where VarID = int,flag=bool, count=Int. Can anybody suggest regarding this how this converson will take …
by can-mohan in Software Development ()
Member Avatar
Hello everybody. I'm trying to write program with vectors and iterators. Coordinates X and Y are entered from keyboard (as structure) and placed in vector of points. It's necessary to display coordinates with maximal X and Y. This code was compiled but not display maximal X. What should I change?
by Auroch in Software Development ()
Member Avatar
Hello everybody! I'm trying to display the result of difference of two-dimensional vectors using friend overloading. Builder shows the following error after compilation (line 40). What should I change for in my code in order to find the problem? Thanks in advance. [C++ Error] 05_Part.cpp(40): E2034 Cannot convert 'double' to …
by Auroch in Software Development ()
Member Avatar
I have declared, SPLINKS contains: 1 3 4 abcmap contains; 1=> 1 2=> 2 6 3=> 1 2 4 I want to iterate both SPLINKS and abcmap to find and erase elements that do not match in both containers; ie after execution; 2=>2 6 //not matched with either 1 or …
by shelton22 in Software Development ()
Member Avatar
I have delared two multimaps such as; And I wrote the following code to traverse the values of multimaps to print the key; From the code I get debug assertion failed as "vector subscript out of range". Can ony one please fix the problem?
by shelton22 in Software Development ()
Member Avatar
I'm working on a bit vector class that I'm using in a current project. Basicly BitVector is a container class for storing and manipulating data a bit level. I have two member fuctions for "setting" and "getting" bits at a given index. I would like to implement the subscript operater …
by Milton Neal in Software Development ()
Member Avatar
Is there a way to sort a vector with a class that has an int variable? I want to have my vector sorted and printed in console. I want to be able to sort the vectors. Say i create a bunch of vectors here on user input Basically if i …
by mystycs in Software Development ()
Member Avatar
Hello, I have the following problem: Entering coordinates of points on a plain with keyboard (as rows x,y). Analysing this coordinates. Replacing coordinates in vector (point - structure data type). Then calculating distance from the first point to all another points. I've written the code of this problem using arrays …
by Auroch in Software Development ()
Member Avatar
Hi, I created a structure Vector and implement some functions to make the new defined type (vector) dynamically allocated and resized (inspired from the C++ implementation of the dynamic arrays : vector). I need to assign a structure to every vector element but I am not sure that I am …
by fadoua_1 in Software Development ()
Member Avatar
i can read elements for 1st vector .however program doesnot go for second vector.
by ravi_14 in Software Development ()
Member Avatar
for(i=a.begin();i!=a.end();i++) { cin>>*i; } for(i=a.begin();i!=a.end();i++) { cout<<*i; } above code works fine but when i use while loop to display vector , program crash. while(i!=a.end();) { cout<<*i; i++; }
by ravi_14 in Software Development ()
Member Avatar
I rote this code in my program Node.h Node.cpp but when i try to ptint id of second item std::cout<<"Item Id ->>>>>>>>>>>>>" << collection[2].GetId() << std::endl; it gets a blank value. but size of the collection is 82, get the correct value for the collection size. i need some help …
by janith.amarawickrama in Software Development ()
Member Avatar
Hi everyone and thanks in advance for the help. I have the following class that throws an error on compiling where i declase a vector of pointers I have an Engine class that I want to host multiple scenes objects stored in the vector sceneList and then pass which ever …
by uonsin -2 in Software Development ()
Member Avatar
Okay so I have a class , which takes a number and a vector as a parameter for the constructor. Everything works well, until I output the values of the vector for every instance. The problem is that the same vector is being shared with EVERY instance I create, but …
by Damian_2 in Software Development ()
Member Avatar
my code: class A{ Vector<String> s = new Vector<String>(); } public class Vec { /** * @param args the command line arguments */ public static void main(String[] args) { A a = new A(); a.s.add("String1"); a.s.add("String2"); a.s.add("String3"); a.s.add("String4"); a.s.add("String5"); Vector<A> vecA = new Vector<A>(); vecA.add(a); System.out.println("Size of vector is "+vecA.size()); …
by narlapavan in Software Development ()
Member Avatar
Okay so I have an class that accesses a static vector from my base class . I also have a class which inherits from . (Both Inventory and SwordShop are derived classes). So for example lets say the user adds into my vector and then adds another one. How can …
by Damian_2 in Software Development ()
Member Avatar
class A{ Vector<String> s = new Vector<String>(); } public class Vec { public static void main(String[] args) { A a = new A(); a.s.add("String1"); a.s.add("String2"); a.s.add("String3"); a.s.add("String4"); a.s.add("String5"); Vector<A> vecA = new Vector<A>(); vecA.add(a); System.out.println("Size of vector is "+vecA.size()); // here i am getting size one a.s.clear(); a.s.add("String6"); a.s.add("String7"); a.s.add("String8"); …
by narlapavan in Software Development ()
Member Avatar
somebody help me please...dunno where i went wrong :(
by jonathan710 in Software Development ()
Member Avatar
Hi, I'm newbie with C++ and I found an example which I need But I've a question, how do I seperate this piece of code into .h and .cpp.. I tried to do something similar on my own but I'm having struggling with it after multiple try.. I've read many …
by coiseng in Software Development ()
Member Avatar
How to sort vector<int> v{3,2,7,6,5,8,1,2,3,4,5}; in decreasing order using function object. I did using lambda expression sort(v.begin(),v.end(),[](int a , int b){return a > b;}); But How we do using fn object
by skyyadav in Software Development ()
Member Avatar
given int a[]= {3,2,7,6,8,1,4,5} vector<int> v(a,a+8) use the stl copy algorithm to display the last 5 integers in the vector to cout with each integer on a seperate line. copy takes three argument. third argument is output container. In this case it is v.but v already have 8 elemenst. How …
by skyyadav in Software Development ()
Member Avatar
I need a little help to store two strings into a vector and reversing the order of each string. i.e. reason for that is I need to add those two numbers together.
by VUEKID in Software Development ()
Member Avatar
I have to find the permutation of vector of integers. I need to implement and interleave function vector<vector<int> > interleave(int x , const vector<int> & v); Using interleave we can implement a permute function. vector<vector<int> > permute(size_t n); that returns a vector containing of the first n positive nos. I …
by skyyadav in Software Development ()
Member Avatar
Hi, Imagine a vector of structures with each structure containing various variables. //input some data from a file into DataSet How can I iterate over this vector, comparing say, x at the nth row to the x at the (n-1th) row and the x at the (n-2th) row, beginning at …
by toneranger in Software Development ()
Member Avatar
This is an assingment i've been working on but since this is a merge between two previous developments i need a little help solving my issue here that would be highly appreciated. In a nutshell what this program needs to do is recieve a .txt file create a vector holding …
by Mantroskylo in Software Development ()
Member Avatar
Hello everyone! I would like your help regarding this: I have a tuple vector which i must iterate through, and accessing the vector data to decide wether to erase or not the current vector element. My code : Could you please suggest me a way to do it? Thanks in …
by ktsangop 23 in Software Development ()