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
-
0
votes1
answer72
viewsHow to assign split lines(Strings) of a vector to an element of another vector. Ex: v[lineAntiga][elementLinhaAntiga]
#include <iostream> #include <vector> #include <string> /*Função para fazer split*/ std::vector<std::string> split(std::string s, char c) { std::string buff{""};…
-
0
votes0
answers16
viewsWhat Are C++ Pointers For?
I am studying C++ for about 3/4 weeks, and I always look for some exercises to practice and in several of these exercises I end up encountering Ponteiros. From what I know so far they store the…
-
0
votes1
answer104
viewsProblem in Binary Tree implementation
Good evening, folks. I am trying to implement a binary tree with methods to insert(Insert,insertLeft and insertRight) and print (print). All goes well until I try to insert a knot in the tree…
-
0
votes0
answers13
viewsImport file . h which has itself imported within this . h
for example, in my file called. h I have the following: #include <Arduino.h> #include "Operador.h" class Chamados { //code; } and in the file Operator. h I have: #pragma once #include…
-
0
votes0
answers24
viewsWould you like to learn about the operator "," in C and C++?
I will put the example of a code I saw below: while(scanf("%d %d %d %d", &h, &u, &d, &f), h) {... } the input stopped when h received value 0.
-
0
votes1
answer52
viewsHow to shuffle names and colors in C++
I’m making a code in C++ and need to shuffle 5 names and 5 colors for a "draw". The code below was what I was able to do so far, but the colors still repeat. #include <iomanip> #include…
-
0
votes0
answers331
viewsUse hpp c++ files
Boas, I’m doing a project for the school, and at some point I realized that I had to divide the work into files (because I was getting confused to find the procedures), but I’m not being able to…
-
0
votes1
answer86
viewsC++ Character buffer adding no characters
Well, I have an application for android that uses Opengl ES 3.1, I did all the procedure to compile the shaders, I decided to put them in a separate folder in Assets, to recover the content I am…
-
0
votes1
answer300
viewsException error in Dynamic List C++
I am creating a chained list in C++ and in condition if (j ->n == x), in the method wasVisited which should check if an element has already been inserted in the list, the following message…
-
0
votes0
answers124
viewsK-nearest neighbors with KD-TREE in c++
I need to implement an algorithm to find the nearest k-neighbors to a certain point in the plane. Most of the material found on the internet be in English, accurate algorithm and working description…
c++asked 6 years, 6 months ago Andre Luiz 115 -
0
votes0
answers30
viewsHow to keep the source in Qt5 when DPI increases
I am having problems when I pass my UI to a user who has a visual windows configuration different from mine. If the user display is at 125 or 150% my UI gets huge fonts in the Labels while the other…
-
0
votes1
answer158
viewsProblem in memory displacement
Good evening everyone, I have been facing a problem regarding free() function in the Dysstroy() method, for memory offset. After inserting values in the binary tree at first I can even displace…
-
0
votes0
answers756
views"A reference to a non-static member must be relative to the specific object" when calling class c++ method itself
I have a class where, within a non-static method, I want to make a call to another non-static one as well. However, by doing so, Visual Studio already gives this warning: "A reference to a…
-
0
votes0
answers134
viewsHow to detect the end of a file reading in a while loop in C++
In my code, there’s the struct: struct material { int idmaterial; double rho; double precokg; }; And the reading function of a data vector of type "material", from a file:…
-
0
votes1
answer115
viewsError with Template
Please, could you help me!? The errors are for all the headers of the.cpp stack file that refers to.h. Involves using Templates. Battery code. h: #ifndef PILHA_H #define PILHA_H #include…
-
0
votes1
answer177
viewsCheck if file has already been copied
How to check the file formula.exe has already been copied to the directory c:\, and if it hasn’t been copied create a copy of it. #include <iostream> #include <Windows.h> #include…
-
0
votes1
answer130
viewsC++ program stops responding when calling a function a second time
I’m doing a simplified game in the style of Pokémon, but is stopping to answer when calling Bootpokemon for the second time, I’m not finding the problem because it works normally with the first and…
-
0
votes0
answers116
viewsStd::Begin and Std::end iterators in the circular list context
The Std::list class creates a circular list. When I create an iterator to go through it I come across an ambiguous situation, which I exemplify: #include<iostream> #include<list> using…
-
0
votes1
answer803
viewsSorted list C++ struct
I need to do a job with this struct and that contains insertion, search and exclusion by year and printing. Only that I am doubtful in the following code. I need right after insertion to be ordered.…
-
0
votes1
answer98
viewschar and constructors in c++
I need a constructor for a class that has char vectors as attributes, like this one: class Anthem { private: int Id; char Name[50]; char Country[50]; int Year; char Composer[30]; char Historic[200];…
-
0
votes1
answer50
viewsDoubts with dynamic lists
In case I need to generate 5 random numbers, and insert them in a dynamic list, I’ve been trying, but the most I can is generate them and display them follows code: #include <iostream>…
c++asked 6 years, 5 months ago Aprendiz nivel lixo 1 -
0
votes1
answer570
viewsHow to identify end of C++ entries using Cin
In my college work, we submit our code to a platform that "corrects" the code automatically (inserts the entries into the code and compares the generated outputs with the template). To get the…
c++asked 6 years, 5 months ago Henrique Schiess Pertussati 11 -
0
votes0
answers900
viewserror: Ld returned 1 Exit status C++
I wrote this code in C++ in Codeblocks with the Register Residents class, but this giving the error error: Ld returned 1 Exit status that I haven’t found anything that would help me on the internet.…
-
0
votes0
answers576
viewsOpengl 3D cylinder and lookat
Hello, I would like to know if there is a problem in the code below. I need to draw a cylinder in the center of the window and rotate through the mouse. The code below generates a very large…
-
0
votes1
answer26
viewsWhere is the macro LITTLE_ENDIAN_HOST and how does it behave?
After finally understanding how the decoding of opcodes works with a project of a CHIP-8 emulator I decided to return to an old project of mine, an emulator of Gameboy, so I started to implement the…
-
0
votes3
answers45
viewsError while printing values, the values that are printed have nothing to do with the values that were saved
It turns out that the gets functions do not return any kind of value. And getMedidasPC(); always returns values -858993460-858993460 regardless of what is written Clientes.h void getMedidasPC();…
-
0
votes1
answer530
viewsHow to split Files in c++
I’m starting my studies in c++, and I’m not able to divide them into different files, if you can help me Master code #include <iostream> #include "Celular.h" using namespace std; int main(int…
c++asked 6 years, 4 months ago diogo.alves 203 -
0
votes1
answer1979
viewsI cannot identify the error - |35|error: ’d' undeclared (first use in this Function)|
I am programming in C/C++ and gave an error that I cannot identify it. #include <stdio.h> #include <stdlib.h> #include <stdbool.h> //Função Principal do Programa int main() {…
-
0
votes0
answers48
viewsDynamic memory with c++ pointers
Hello, I’m starting to use dynamic memory in c++, but I ran into a problem. When I do new CHAR_INFO[3], says cannot Convert 'CHAR_INFO* {aka _CHAR_INFO*}' to 'int*' in assignment and still misses…
-
0
votes1
answer55
viewsProgram in C++, string no longer accepts characters, and hangs the console, what happens?
I made a program in C++ converting morse code to letters. However this program will receive up to 1000 characters. But I do not know what happens, it receives 400 characters at most, and so the…
c++asked 6 years, 3 months ago Victor OCV 393 -
0
votes1
answer42
viewsHow much can the access cost of an unodered_map hinder the performance of a game?
The cost of access to unordered_map can cause FPS to drop in a game if it is accessed thousands of times per second? class var { public: template < typename t = double > static inline auto…
-
0
votes1
answer372
views2597 - Uri Online Judge - C++
I’m doing a show in C++ to solve the 2597 platform math exercise URI ONLINE JUDGE follows below the description of the problem. I started doing the program in C++, but realize that the input is too…
c++asked 6 years, 3 months ago Victor OCV 393 -
0
votes1
answer322
viewsHow to test the execution time of a code in Visual Studio 2017?
I’m trying to test the execution time of a code, but I’m always getting incorrect values, the first test will always be the one with the worst time. And most of the time the second test is always 0.…
-
0
votes1
answer74
viewsHow to use the Tbitmap32 (Delphi) type in a DLL called in C++?
Hello! I need to create a DLL in Delphi, to use it in a program written in C++. This DLL shall handle an image (obtained by means of path passed as a function parameter). However, I’m having trouble…
-
0
votes0
answers21
viewsImage resizing dds via software
I’m having a little doubt, I was analyzing the files of a software in Directx 8 and I saw that it does something that I can not understand how, it takes a base image, let’s call frame dds. and…
-
0
votes1
answer114
viewsIs that piece of code redundant?
I recently did a C proof in which I had to complete a code to remove items from a queue, follow the code with the answer considered correct highlighted: typedef struct No { int dado; struct No…
-
0
votes2
answers439
viewsCalculate sequence of triangular numbers smaller than 1000
I’m a beginner in programming and I’m struggling with the following problem: Make a program that calculates and prints all triangular numbers smaller than 1000. A triangular number is a natural…
c++asked 6 years, 3 months ago Gabriel Neri 11 -
0
votes1
answer46
viewsFile function in C++
Hello I have a problem using the file function, I need to make a program that registers the place and the name of the person in a bus but the problem is that every time I close the program and open…
-
0
votes1
answer169
viewsNumeric Counter
I must create a program that commands a hardware in which I have connected on 3 different ports of the Arduino a circuit containing 3 Leds. The program must ascend these leds in binary order. I have…
-
0
votes0
answers85
viewsMemory junk when pointing a pointer
In an attempt to implement an adjacent matrix graph, I created the function to create a new "matrix" in which the contents of the graph would be copied to it by adding the new positions. However,…
-
0
votes0
answers185
viewsCreate a TAD to represent a data
I have the following task: Create a TAD (struct) to represent a Circumference and then check which of the read circumferences intersect between them. I need to store four basic data, id, x, y and…
-
0
votes1
answer60
viewsFailed to recover a custom item in a Qlistwidget
I am trying to recover data from a Qlistwidgetitem when I click on the list but am not getting it. I made a custom Widget to list the elements, but although I can not see in the event click recover…
-
0
votes1
answer32
viewsCompile error gmock
Good evening, I’m practiced testing on c++ used the google gtest/gmock testing library. Everything is working perfectly well with gtest, but I cannot compile in any way when I try to use gmock. To…
-
0
votes0
answers92
viewsAdapt code to return mouse position
I have the following code that shows me the values of the coordinates X and Y when I double click with the left mouse button. #include <opencv2/opencv.hpp> #include <iostream> using…
-
0
votes0
answers60
viewsC++ - Set and remove specific bits from a single
I am developing a Gameboy emulator and one of the tasks is to set the flags after each instruction: ... //Representa pares de registradores do gameboy union RegPair { std::uint16_t reg; struct pair…
-
0
votes0
answers31
viewsQt - Perform an action when a dialog is loaded
I have an application that serves to manage a barracks of my city, on the sniper registration screen I would like to check before if there is a class registered in the database, if not close the…
-
0
votes0
answers66
viewsWhen printing string, meaningless characters are shown
I need to do a program that calculates the average salary of a company, asking the user for the amount of employees, the name and salary of each employee and returning the average, the name of the…
-
0
votes1
answer240
views'function name_name': identifier not found
void inserePoli1(poli **topo1, int val, int expo) { polinomio1 *novo; char cmd; novo = new poli; novo->valor = val; novo->expoente = expo; if (*topo1 == NULL) { novo->prox = NULL; *topo1 =…
-
0
votes0
answers30
viewsSegmentation fault 11 when reading a CSV file in C++
Good night, you guys! Next, I made this code from a response from here of the stack overflow and it’s giving Segmentation fault 11 on the last line of the file, someone help me solve, please! This…
c++asked 6 years, 2 months ago Lucas Fellipe 1 -
0
votes1
answer556
viewsDoubt binary search c++
https://www.codepit.io/#/problems/5369c33df6fa9de49e5c7d0e/view? index=1 I managed to resolve this issue as follows: #include <iostream> #include <algorithm> using namespace std; int…
c++asked 6 years, 2 months ago Gabriel Neri 11