I’m trying to create a queue of 2D vectors and see the contents of it each time I push a vector. I tried to implement this and print it with the idea of printing 2D vectors in my head. I have also tried some templates online. Apparently, it does not work that way for a ..
Category : 2d-vector
So for AC circuits, you sometimes have to solve linear systems with complex numbers and I’m making a quick and dirty program to do it for me. I’ve written the code that will create a matrix (2D vector) of user-defined size and input, I just can’t figure out how to get it to perform the ..
I tried to write a program where a vector is calculated that bisects the angle between two lines that share one common point. For that I’ve come up with some code (Since this it not the only thing I’m trying to do the code is a bit longer but I’ve boiled down the problem to ..
I am trying to create a 2-D vector that as column 0 it would have integers and column 1 would have vectors. For example: column[0] column[1] 2 {2} 5 {1,2,0} 12 {4,7,9,0,0,1,6,0,0} 3 {6} column 0 would be user input while column 1 I will calculate it on my own – I don’t mind if ..
Hello I am pretty new to c++ and I am trying to implement a small program that iterates over a 2d vector backwards and adds the value of the vector to points. If the points have already been added then I want to overwrite the value of the vector with 99. So for example if ..
I’m taking input from a txt file and storing it in a 2D vector. That part works fine. My program seems to error out as soon as I try and access individual elements of the 2D vector. From what I’ve searched, I’m indexing the vector the correct way, so does anyone know why this would ..
I want to declare a 2D vector but I get the error : expected ‘;’ at end of declaration [29, 43]. I don’t understand why, my code seems to be correct. I’ve tried with a 1D vector but I get the same error. For me, my syntaxe is correct. Can someone explain me what the ..
I have the code: vector<vector<string>> elements; string value; /*add lot of elements to the vector*/ value = vector[1][2]; And it gives errors. Source: Windows Que..
The question is quite straightforward. After some trials, here is the most efficient code I found: //For the sake of the example, I initialize every entry as zero. vector<float> vector1D(1024 * 768, 0); vector<vector<float>> vector2D(768, vector<float>(1024,0)); int counter = 0; for (int i = 0; i < 768; i++) { for (int j = 0; ..
The program is an attempt to store tuples containing string:serial and int:profit within a 2D vector: serial declared by vector <vector <tuple <string, int> >> serial; serial is supposed to hold tuples with serialnames and profit value of a ticket in as elements in 2D vector of series v/s numbers. I could not remove the ..
Recent Comments