Most voted "c++" questions
C++ is a typed, compiled, multi-paradigm, intermediate level, and general purpose programming language. It should not be confused with the language C. It was developed in the early 1980s by Bjarne Stroustrup as an extension of C. Its evolutionary features include type checking, support for automatic resource management, object orientation, generic programming and treatment of exceptions, among others.
Learn more…2,348 questions
Sort by count of
- 
		1 votes2 answers889 viewsTransfer content from one stack to another C++I need to solve a question, she asks me to display the contents of a stack in reverse form, I thought a lot and I came to the conclusion that it is only possible to create an auxiliary stack and… 
- 
		1 votes0 answers82 viewsDifficulty with loops for memory gameThe program refers to a memory game composed of 3 4x4 arrays, where the player is against the program. My difficulty lies in the action of the program in cases where the player hits the pair of… 
- 
		1 votes0 answers21 viewsTransparent SMFL screenI just installed SFML, I did everything correctly as it seems, because the program does not indicate errors and I repeated the process carefully 3 times in codeblock and twice in visual studio… 
- 
		1 votes0 answers67 viewsHow to get Getmodulebaseddress from a C++ process?I’m trying to get the Getmodulebaseddress of a process I’m trying to monitor, however I’m not getting why I have the offsets, add they however does not work, if I just access the process there yes I… 
- 
		1 votes1 answer32 viewsHow to write a variable Std::vector<Std::tuple<>> into a txt file?I have the tuple vector written in C++, defined as: std::vector<std::tuple< float, float>> ASK_Mod; I populated it, and tried to save it in a new file . txt as defined in the function,… 
- 
		1 votes1 answer38 viewsOpencv build does not find includeI’m trying to compile a simple code just to test but when I compile with both g++ and Clang++ they say that the reference to the method was not found. I followed the steps of this official Opencv… 
- 
		1 votes1 answer104 viewsHow to convert a tuple to a`void`pointer vector?I have tuples with objects that can have different types. How I would generalize the following code: #include <iostream> std::vector<void *> to_vector(std::tuple<int, double,… c++asked 5 years, 8 months ago Daniel Falbel 12,504
- 
		1 votes1 answer86 viewsProblem for centralized printing in CI have the following problem, in my code I want the program to centrally print the number 1 after the "word", and to center I am using the parameter "%-20s \t" to try to center the number after the… 
- 
		1 votes1 answer50 viewsHow to know the last element in a Qlistwidget?I have a Qlistwidget called list_toMerge with some items added, then I created 2 buttons to change the order of the items. The up button and the down button. First look at the code in the up button:… 
- 
		1 votes0 answers24 viewsTreat Undefined binary code reading behavior as different typesThey say that this inline function code has "Undefined behavior", either by binary codes of the same meaning in float and different in other types, or because the order of storage and use of the… 
- 
		1 votes0 answers29 viewsWhy is part of a line repeatedly printed when reading a csv file?Hello. I wrote a code to read a csv data file and print your data on the screen, but the last surname and age repeat in the last line. What’s wrong with node code to print this last line? Later I… 
- 
		1 votes1 answer252 viewsC++ free(): invalid aborted when trying to create a functionI am trying to create a library for operations with matrices in C++ but am running into a problem. I created a function to print on the screen a certain matrix. The function even returns the… 
- 
		1 votes0 answers44 viewsOptimization in competitive programming - C++ - TLE problemI’m solving a question that asks us to print on the screen the winner id of each test round. The game works as follows: N cards are dealt to P players of a total of G cards. The letter [G - N*P+1]… 
- 
		1 votes0 answers42 viewsWhy can’t I read that file with fstream?I am studying the input and output C++ files part, but I find myself with a small problem. I’m trying to get the program to read a file called "name.txt" with 10 names inside it, but for some reason… 
- 
		1 votes2 answers860 viewsMedia calculation using C++ FunctionI’m doing a program where it calculates arithmetic, harmonic and podenrada media using a function called note in C++. At the time I compile the media result only returns 1. #include<iostream>… c++asked 5 years, 4 months ago João Victor 19
- 
		1 votes1 answer48 viewsVector does not print correctlyCreate a program in C++. Have a vector of integers of 10 positions filled by the user. Print the sum of the components of this vector. I made the code below but it does not print the values of the… 
- 
		1 votes2 answers342 viewsError exited, Segmentation fault in CI’m trying to make a function that returns me a date according to an integer and always appears the error: exited, Segmentation fault The code I created is basically this: #ifndef DATA_H #define… 
- 
		1 votes1 answer196 viewsHow to remove an object from a list chained by the value of the attribute in C++?What is the best way to remove an element from a list by the value of its attribute, without knowing exactly its position? I realized that the method Erase remove by position, and tried to use along… 
- 
		1 votes3 answers138 viewsThe main function and its arguments. How does it manage to assign to its argc and *argv[] arguments the parameters passed via terminal?For my question to be clearer. Suppose my program, called main, needs to receive any number of console parameters. To do so, I would have to do it. int main( int argc, char *argv[] ){ ... return 0;… 
- 
		1 votes1 answer77 viewsData Structure, Dynamic Memory Allocation in C++ and Data ReadingI have a code with encapsulation and composition with 3 classes in C++. In my code I have to display objects in a static way but I want to create them dynamically. I have a class called worker that… 
- 
		1 votes2 answers25 viewsError in C++:Undefined Symbol: Rec::nGood night to you all! I’m studying C++, and gave error in the code I tried to compile. I believe it is because the example is a very old book. I’ve tried some kicks, but I haven’t been able to… 
- 
		1 votes1 answer35 views
- 
		1 votes1 answer124 viewsHow to change the color of each rendered object in opengl C++ with shaders?I’m learning now Vbos and Vaos, and I can’t draw objects of different colors, they are rendered with the same color. I tried to use Uniform but I couldn’t make it work, how can I do it? Fragment… 
- 
		1 votes1 answer88 viewsRemove() function does not delete the file in CI am trying to delete a file and soon after rename another file, but it turns out that the remove function does not erase the file. I tested on two machines, giving full permission, but without… 
- 
		1 votes2 answers62 viewsRepeat loop in C++Good night, my friends! I’m starting the ADS course and I have a question. I need to create a loop of repetition for 50 students by collecting 4 grades of 4 exams, and at the end, present a report… 
- 
		1 votes0 answers53 viewsDoubt about building and linking libraries (C++)I am using the Codeblocks IDE and would like to use the functions of an external library called Chilkat in my code. I can make the IDE read the header, but when I try to use some function or object… 
- 
		1 votes0 answers15 viewsMount a c++ scriptHello, I wanted to assemble a script in c++ capable of detecting the color of the pixel on the cursor and if detecting run the click function Here to detect the color of the pixel:… 
- 
		1 votes1 answer35 viewsWhy should one use extern in a variable declared in a header file?I was searching in the background about C++ header files after I often got the error LNK2005 in the compilation of Visual Studio, and I realized that the error was that I was declaring a variable… c++asked 4 years, 10 months ago Luiz Fernando 345
- 
		1 votes1 answer90 viewsThe loop of choice must end or continue in a menuI have two objects that receive parameters by the standard system entry, but when the user chooses to continue or exit, the loop does not obey the output and when obeying the output does not obey… 
- 
		1 votes0 answers76 viewsREQUEST POSTGreetings, I have a test python server: from flask import request, Flask app = Flask (__name__) @app.route ('/Teste', methods=['POST']) def teste(): recebido = request.form['variavel']… 
- 
		1 votes1 answer44 viewsProblem rendering multiple objects in Opengl Legacy (GLFW)I am trying to render a circle and a rectangle, and both will have independent motion (Remake of Pong), but the problem is that the glTranslatef() of one is influencing the other, if one goes to the… 
- 
		1 votes2 answers88 viewsArithmetic Burst C++Hello, I am a beginner in the C++ language, doing some exercises I came across a message that did not interfere in anything my account, but I would like to know exactly what it means and what I… c++asked 4 years, 9 months ago MICHEL LEMOS 45
- 
		1 votes0 answers62 viewsDifference between string size in Standard C and C++I compiled the following code in C Standard and C++: #include <stdio.h> #include <string.h> char string[5] = "hello"; int main(void) { printf("string tem %lu bytes\n", sizeof(string));… 
- 
		1 votes2 answers78 viewsAccentuation in C++ VisualstudiocodeI’m trying to use the accent in c++ but in the output the text continues without formatting I’m using the visual studio code. #include <iostream> #include <locale.h> int main () {… 
- 
		1 votes0 answers40 viewsC++: Add an integer variable in an ordered way in a listI need to add integers in an orderly way, within a list implementation that I developed. //Implementação dos nós para serem usados na lista NodeList::NodeList(int dataa){ this->next = NULL;… 
- 
		1 votes3 answers59 viewsValue of a "for" returned infinitelyContextualizing: I have an exercise that suggests creating a program to read student grades and show grades equal or higher than average. Thus, the following code was written: #include… 
- 
		1 votes1 answer68 viewsUpdate the console without flashing C++Hello, I’m doing a game of the cover, the game is already finished, however, I believe by the high frequency of system("cls"), the console keeps flashing, and I wanted to know how to fix it Here my… 
- 
		1 votes2 answers46 viewsHow to iterate over a string by obtaining the indices of each character in C++?Example done in Python: editor = 'Luiz' for contador, letra in enumerate(editor): print(f"A letra '{letra}' está no índice {contador} ") I was wondering if it’s possible to do this kind of counter… 
- 
		1 votes0 answers23 viewsScope problem in namespace and class, C++I tried to create a complex class in a C++ namespace per exercise, but when I try to define some methods of my class, the compiler returns error. My code: Complex. h: #ifndef COMPLEX_N_H #define… 
- 
		0 votes3 answers435 viewsHow to loop in openMp to count lines from a text file?How to loop using the library OpenMP to count lines a file? #pragma omp parallel for for (string line; getline(file, line); ) { count++; } This way he doesn’t execute, it seems he only accepts for… 
- 
		0 votes1 answer196 viewsHow to validate the price in Qt?I would like to know how to validate the price in Qt, as follows: Accepted examples: 10,00 / 100,00 / 1.000,00 = true My code, (but it’s validating true: 10 / 100) bool ok;… 
- 
		0 votes3 answers85 viewsAllocator and placement newI have a problem with placement new along with a "homemade allocator". The problem is that for data types (int) it works well, now for double, they start to trim very strange outputs. The classes:… 
- 
		0 votes1 answer785 viewsHow to parallelize this code snippet using OpenmpI’m trying to parallelize an activity using OpenMp. I having problems because after the first is the code below the result shows wrong. #include <stdio.h> #include <fstream> #include… 
- 
		0 votes1 answer63 viewsUpdate a Combobox after opening QdialogHow do I update a Combobox after opening a Qdialog? The code below does not update if you have an update in db. I have to close the application and open to show the new data: Dialog::Dialog(){… 
- 
		0 votes1 answer919 viewsHow I develop a method of a binary tree class of searchHow do I develop a method of a binary tree class of search, to return multiple elements of 5 in a list? C++ 
- 
		0 votes1 answer31 viewssqlcipher compile plugin in windowsHow do I compile the plugin in windows? I’m doing like this: Git Clone sqlcipher - C:\sqlcipher installed MINGW32 - C:\MINGW32 installed msys - C:\MINGW32\msys\1.0 installed tcltk-8.4.1-1-… 
- 
		0 votes1 answer743 viewsHow to close the app console?I run this program with the executable, but it remains to close the console that is open after running, how to do this?… 
- 
		0 votes1 answer77 viewsMultiple Definitions in the moc. file of a classI’m having many Multiple Definitions problems in QT. For common classes, and all classes in our library, the solution was to put the header and implementation in the same . hpp, and it worked. In… 
- 
		0 votes1 answer84 viewsHow to listen to events without opening a window?I’m doing a simple project of console people who are going to make Keyboard hooking, but I don’t want you to open the SFML Opengl window. There is a way to listen to SFML events without opening a… 
- 
		0 votes1 answer47 viewsHow to store the Pxfixedjoint class in a vectorI’m trying to store the class PxFixedJoint in a std::vector with the method push_back. But the vector is always empty, simply adds nothing. Down with the code. // C++ // Declaração do vector para…