Most voted "vector" questions
In C++ the Std::vector container is an array and generalizes the concept of a vector. It can be accessed through indexes for the elements as well as in C (through a proper operator overload) and its memory is allocated contiguously. However, unlike an array, the container size is dynamic with automatic management and there is greater flexibility to add elements.
Learn more…78 questions
Sort by count of
-
0
votes1
answer84
viewsProblem zeroing out a game score
Well, I read Bjarne’s book on programming and I’m learning programming there, I’m in chapter 5 which is about mistakes, at the end of the chapter there’s a list of exercises for me to do, I came…
-
0
votes1
answer278
viewsC++ Heterogeneous list
I’ve been searching the internet for weeks about lists (vector, array, list) heterogeneous in c++, however, in all websites and forums, the answer is the same: boost::any, but I wanted a way to do…
-
0
votes1
answer197
viewspush_back in Vector 2D, emitting error "no matching Function for call"
I’m a beginner in C++ programming, so I apologize in advance. As this question answered here, it is possible to use std::vector, 2D (grid) with push_back() directly (variavel[indice].push_back(...))…
-
0
votes1
answer51
viewsList with 3 c++ elements
I’m using list in c++, and in what I think its internal structure should contain: Content pointer to the next element It is possible to place one more variable within this structure, as the example…
-
0
votes1
answer186
viewsHow to pick a pointer from a class c++ vector
How do I pick a pointer from a vector of class c++? For example I have a vector a; how do I receive a pointer to only one vector element?
-
0
votes2
answers1281
viewsHow to pass a vector class vector as a function parameter?
The contents of my vector are the data I wish to place in the matrix: int main() { vector<int> dados; int valores[4]; string val; ifstream arq ("matriz.txt"); if(arq.is_open()) { while(!…
-
0
votes1
answer80
viewsExercise Vectors, I’m stranded
It is intended to elaborate a program that asks the user for integer numbers and stores them in an array, this procedure is repeated until the user type the value zero. At the end the program should…
-
0
votes1
answer63
viewsFails when accessing a vector option that does not exist
I made a few years ago an algorithm of inheritance and polymorphism it is working correctly but if I type 7 that is a non-existent option in the menu it returns segmentation failure instead of…
-
0
votes1
answer44
viewsReading values from a string
I just started studying c++ and I don’t quite understand it yet. I need to get a lot of information on each line of a string vector, so I thought I’d use the sscanf, however I am getting the…
-
0
votes1
answer192
viewsHow to use map / create keys to store c/c++ cycles?
What is the most efficient c/c++ structure that I can use to create and store cycles, so that I can ensure that repeated cycles are not stored? I have a CICLO struct, such that: struct CICLO {…
-
0
votes1
answer100
viewsvector<double> using ctypes for DLL in Python
I own a .dll that within it has a function BOLHA that returns a double. The problem is that BOLHA has a vector<double> in the argument. extern "C" minhaDLL_API double…
-
0
votes1
answer57
viewsAccessing methods of a class on a vector of pointers
All right, I have a Package class with a public method double calculate_cost(). I need to create a std::map<string, std::vector<Package*>> where I can iterate through the array and save…
-
0
votes1
answer31
views -
0
votes1
answer60
viewsHow to know the intensity of pixels in a given row or column of a cv::Mat?? [opencv][c++]
I have a project where there is a need to analyze the intensity of the pixels of a certain column or row, that is, my function will be Intensity(cv::Mat m, int ref, Std::string "lico") with a…
-
0
votes1
answer455
viewsProblem turning string into int: "error: no matching Function for call to stoi"
I’m writing a little show input a string of integer numbers as a string and as output an array with twice each of the numbers, also as a string. Despite the function atoi be indicated in that reply,…
-
0
votes1
answer51
viewsHow to sort an array using two attributes?
Come on... I have a class Student, which contains the attributes name, idCurst and situation. I also have a vector that stores several objects of the Student type. I also have a method ordain() that…
-
0
votes1
answer58
viewsHow to sort an array using three attributes?
Come on... I have a class Student, which contains the attributes name, idCurst and situation. I also have a vector that stores several objects of the Student type. I also have a method sort() that…
-
0
votes1
answer45
viewsHow to insert data into a member vector of a struct?
I’m trying to build a structure composed of members that are no more than strings. The 4th member is a string array, since it needs to store more than one piece of information. Once done I declare I…
-
0
votes1
answer44
viewsHow to use Bezier curves to describe 3d animation in c++ efficiently?
I’m developing a 3d program in c/c++, I’ve done the rendering part of the objects, I’m missing the animation part, basically I want to use a list of values (frames) each containing the frame time,…
-
0
votes0
answers29
viewsSET method does not modify vector attribute on object of a class
Follow the full code: // sistemafinanceiro.h #ifndef SISTEMAFINANCEIRO_H #define SISTEMAFINANCEIRO_H #include"banco.h" class SistemaFinanceiro { private: Banco banco; public: SistemaFinanceiro();…
-
0
votes1
answer37
viewsUsing Function that did not have the library included in C++
I was reading about the function max_element in the documentation of C++ which is a function that points to the largest element in a list, vector, etc... And there it said that this function belongs…
-
0
votes1
answer43
viewsVector problem in C++
I’m doing a code to create password and user, of course saving them. But in this part of the program it does not work, it gives error. void criar_senha(){ cout << "Digite a senha usando letras…
-
-1
votes1
answer179
viewsSending a C++ vector to a Python function
I have the following function written in python in a file. py: def coordinate(arg): print arg return True And an example of C++ code in a file. CPP #include <Python.h> #include <vector>…
-
-1
votes1
answer75
viewsSomeone experienced who understands string manipulation well, who can help with this error
Good morning, I am presenting a problem that I have no idea the reason, I have tried to ask other people, none discovered the real reason for the error and how to repair it. Good my teacher, asked…
-
-1
votes1
answer64
viewsHow to invert a vector in C?
I created a function to reverse vectors however when I run the program I do not see anything. This is my code for now: #include<stdio.h> #define DIMV 30 int lerIntPositivo(){ int numero; do{…
-
-1
votes2
answers53
viewsArray in C - How to print values from an Array
How can I take this information from the keyboard, name and value of three products, and print in table form the name with its value beside? I did so (code at the end), but at the moment appears the…
-
-2
votes1
answer24
viewsIs there a way to access a Vector programmable?
I have a vector of a star and wanted to access a path of it from within my Java class to change the color. <vector android:height="24dp" android:viewportHeight="197.24483"…
-
-2
votes1
answer54
views