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
votes0
answers40
viewsHow to send an object using socket c++ visual studio
I am trying to send an object to a server socket. The client and the server have the same class that I use to store the data. It’s all working this way, but I’m having problems on the server side.…
-
1
votes1
answer1293
viewsRead from txt file to char vector
I have a file dados.txt with (fictitious) Cpfs in the following format: 382031758-71 647900189-01 460754503-73 696170135-72 And so on, being in total 500 cpfs. I’m trying to read each and put in…
-
1
votes2
answers112
viewsProblem banknotes and coins
The given question required that scanf be used to read a certain floating-point value from 0 to 1000000 and print how many 100, 50, 20, 10, 5 Reals and 2 Reals, and how many 1 Reals, 50.25, 10.5.1…
-
1
votes2
answers218
viewsHow to go through a set with entered data?
I have a little program that inserts a few integers into a set, and removes when I find the same one, after doing this, I need to bring out all the integers that are still inside the set, but I’m…
-
1
votes1
answer97
viewsRemoving number by number from a sequence of numbers to compare them
My professor of algorithms and programming techniques passed an exercise in which a = "123567348" and from that I would say which numbers are even and which are prime. He said he would have to use…
-
1
votes2
answers557
viewsKnow if value is in the unparalleled equality array!
I have the following code in C++: #include <iostream> using namespace std; int main (void){ int e[5] = {10,20,30,40,50}; for (int i = 0; i <= 99; i++){ if ( i in e ) cout << e[i] ; }…
-
1
votes2
answers297
viewsQuestion about a C++ function that functions as a destructor?
I understood all the code below but in a certain part the person cites something as destructor? What is it? What is it for? That would be the part here: ~Vetor() { delete [] vet_pos; delete [] vet;…
-
1
votes1
answer6449
views -
1
votes1
answer73
viewsRead Dates file and count days elapsed in the year
I am trying to make a program that opens a file and calculates the days elapsed from the date. The dates are in the file as follows: 30-10-2018. But I’m having trouble with the output that is…
-
1
votes3
answers98
viewsIncorrect reading of floating point
I have a file that stores products, each product has three information: its name (char *), quantity in stock (int) and its price (float). The information generated in my program I am saving in a…
-
1
votes0
answers36
viewsDijkstr finds no path less
I’m implementing Dijkstra’s algorithm to find the shortest path on a network. Starting from a node of origin s, I need to calculate the shortest path to reach all other nodes that exist on the…
-
1
votes2
answers226
viewsBuild error in C++ when accessing structure in function
I’m creating a code that holds the information of three people inside one struct, but I am having a build error when I will save the age option on struct. The mistake is this: /home/arthur/Área de…
-
1
votes0
answers71
viewsTry to read a. txt file
Well I’m trying to read from a . txt file, but when I try to read and put in variables it’s giving me all the wrong info, now wrong places. I’ve tried to use Debug’s tool but can’t figure out why...…
-
1
votes2
answers181
viewsProblem about discrete mathematics - C++
I have this problem to solve, about the Principle of Casa dos Pombos. However, it is 25% error and has only one entry. For some unknown reason, Rangel only has a pair of socks of each color. Today…
c++asked 6 years ago Beginner Programmer 69 -
1
votes0
answers47
viewsSDL2/C++ - Loop at a specific frequency
I have a project of an emulator CHIP8 that was already stopped a long time ago so I started working on it again today, I can already extract and draw sprites and I’ve implemented almost all the…
-
1
votes0
answers59
viewsConversion of DWORD
Hello I have the following code snippet #include <windows.h> #include <d3d8.h> #include <d3dx8.h> #pragma comment(lib, "d3d8.lib") #pragma comment(lib, "d3dx8.lib") typedef…
c++asked 6 years ago Renan Moura 11 -
1
votes0
answers25
viewsI’m not able to add the same variable to a stack and draw it
I’m trying to make a program that makes a stack of objects using lib stack and soon after draw whatever is on top, to do some tests I was doing the following: int main() { RenderWindow…
-
1
votes1
answer441
viewsStruct with JSON in C++
I’m having problems inflating a struct using a JSON file, in fact I don’t know how to do it, I’ve been researching about the Jsoncpp library, but I was not successful. Follow a simple example of my…
-
1
votes0
answers46
viewsHow to promote Qgraphicsview in Qchartview?
I’m new to Qt Creator, I want to know how to present 2 or 3 graphics on a single screen, I’ve seen some examples that Qt provides, but they don’t show how I want to learn how to do it, please Help.…
-
1
votes1
answer108
viewsHow can I create a layout like the image with QML?
I’m learning QML now and I want to create something similar to the image attached, I’ve tried to create something but I can’t manipulate the vertical menu buttons and leave it like the image,…
-
1
votes0
answers33
viewsI can’t add the name to the struct
typedef struct Pessoa { int id_pessoa; char nome[100]; int idade; float peso; }PESSOA; //FUNÇÃO PARA PEDIR OS DADOS DA PESSOA PESSOA DadosPessoa(int nrpessoas) { PESSOA *pessoa = (PESSOA…
c++asked 5 years, 10 months ago Rui Correia 11 -
1
votes1
answer101
viewsHow to run a Gtkmm C++ application on Windows without MSYS2?
To use (as far as I know) Gtkmm graphic libraries in Windows, I have to install such libraries in MSYS2. So far so good. Every time I install and write a C++ file and compile by g++ on MSYS2,…
-
1
votes0
answers20
viewsInterrupt service routine
Hello! I’m working with Atmega1280, just started. I don’t know how to use the interrupt. I want to read the state of a pin (PIN 7) and count the time it remained HIGH and then print it. The input…
-
1
votes0
answers41
viewsLinkage problem "Undefined Reference"
I’m trying to compile a dynamic library that uses a static library. I’m using cmake and the problem I’m having are linkage errors, where static library methods are giving error "Undefined…
-
1
votes0
answers63
viewsC++ How to take the string of the get method of a class x and concatenate with a class y string?
I am programming a code in Qt(C++) and I need to take values from the client class in the menu class (which I do not inherit from client) and concatenate into a string to print on the screen.…
-
1
votes2
answers81
viewsVariable not holding the assigned value
I’m doing a project and I came across a problem. #include "iostream" #include <cstdlib> using namespace std; int per2 (void); int per3 (void); int per4 (void); int main(void) { per2(); per3();…
c++asked 5 years, 8 months ago Darius da costa 303 -
1
votes1
answer170
viewsAlgorithm to traverse an array
So I’m having a simple logic problem but I can’t find a good solution. Problem: I’m looking to go through a registry file (a .csv whose I have to solve a RMS - Root Mean Square calculation). But I…
-
1
votes1
answer116
viewsHow do you make an array of Labels in C/C++?
It is a fact that exists in Assembly (Nasm) and it is a fact that this is a quick way to follow to a point of the program among several. Here is an example code for x64 where you choose one of five…
-
1
votes2
answers104
viewsHow to correctly choose a data type
Normally I always programmed without paying much attention to it, always used int, float, double and so on, but more recently I saw a person commenting that currently float is a useless type because…
-
1
votes1
answer82
viewsA float x==0 includes values like 0.7. How to change this?
Hello! I’m new to the programming world and I’m making a small calculator. I made an if that terminates the program if the user tries to divide by 0, but when I try to divide by for example 0.5 the…
-
1
votes1
answer138
viewsChange the Excel icon
Hello, I start apologizing, I’m not from C or C++, but I really need a help that can be given by as much as the other, I work with Excel solutions modeling the XML interface, I created an…
-
1
votes1
answer100
views"Skeletonize" figures
I wrote code to "skeletonize" figures, that is, to reduce their thicknesses to just one pixel. I had already written the code in Python that worked correctly. However, the same code rewritten to…
-
1
votes1
answer400
viewsCout string c++
I have a function Show() which traverses a list and should display it on the screen, but I cannot concatenate the value of a list with a string. Follows code: #include "pch.h" #include…
-
1
votes1
answer151
viewsC++. Generic class receiving lambda and struct function
Expensive, I’m trying to do some things in C++, but I’m still starting both in language and in the functional paradigm. What I need is to insert a function lambda in a pair. The first member of pair…
-
1
votes1
answer3892
viewsMy question is about the error: 'Function' "Was not declared in this Scope"
I am creating a system of records and login as a form of practice, but I keep finding this error and although searched a little, I can not find the solution. #include "registration.h" //Outras…
-
1
votes2
answers1808
viewsI cannot declare variables as a string in my C++ code
#include <iostream> #include <stdio.h> #include <string> void print(float arr[], string nome[], int x){ for (int i=0; i < x; i++){ printf("O aluno %s obteve media de %2.2f\n",…
-
1
votes1
answer90
viewsLarger and smaller DEV problem of a value
Can someone help me fix the higher and lower command basically it has to speak the largest number of a value and the smallest number of the same value. Example: I add the value 727522 the program…
-
1
votes1
answer50
viewsError in solving an OBI problem
I’m trying to solve the problem Wifi of OBI 2018 and I had the idea to create a code that will read and store the coordinates of the rooms and then check if it is "docking" (outside) another room.…
-
1
votes1
answer76
viewsHow to save samples before and after an event in a circular buffer?
Hello, I’m processing a 17-hour audio dataset. wav (16-bit PCM, 192khz), to simulate a "real-time" processing that will be embedded in an ESP32, Arduino DUE or a RASP, depends on the results. How…
-
1
votes1
answer332
viewsSum of digits of a string only works when I do a subtraction I don’t understand
The program receives a string size up 10^6 and add the digits. I made the code, but to each loop 48 is added to the sum variable. If I modify the tenth line as soma = soma + nome[x] - 48 the problem…
-
1
votes0
answers60
viewsQuery return problems [Qt Mysql]
Considering the following table: ID : int Quantidade : smallint PrecoUnitario : float(5,2) I tested the following Query in Mysql Workbench: SELECT ID, SUM(Quantity * Precounitario) FROM test GROUP…
-
1
votes1
answer647
viewsDynamic allocation in C++
I was learning a little bit more about dynamic allocation in C++ on the Internet, and a teacher’s code caught my attention. It is a code made to spend only the necessary memory and not have "blank…
-
1
votes0
answers46
viewsProblem Including SDL in Codeblocks
I’m downloading the mingw SDL from this website. I unzipped the zipped file and copied those folders: bin, include, lib And I taped them all together on the way to Codeblock C: Program Files (x86)…
-
1
votes1
answer245
viewsArduino’s Serial.read() does not work as expected
In the void loop, I need it to read the difficulty, instead it keeps returning the string on the monitor. I’m spinning in this tinkercad project //Vamos começar definindo as notas para os sons…
-
1
votes0
answers29
viewsRead memory variable(Baseddress + Offset)
I’m trying to read a variable within another process, in the case of the game "Spider Solitaire". So far it’s all worked out, but when I close the game and open again it doesn’t work anymore. I know…
-
1
votes1
answer70
viewsObject orientation and meaningless values in c++
Hello, I’m starting programming in c++ and I decided to do a struct to learn and such... except that the compiler shows no error and at the end the program shows me a completely meaningless value,I…
-
1
votes2
answers514
viewsPass class object as constructor parameter in C++
Good afternoon, you guys! I’m studying for a C++ test I’m doing this week, and I’m having a hard time passing an object as a constructor parameter. Could you explain to me the right way to do it? I…
-
1
votes1
answer76
viewsHeader Datalength with Arduino
I need help sending a HEADER, produced in Arduino (C++), and sent to a server Zabbix. Header documentation https://www.zabbix.com/documentation/devel/manual/appendix/protocols/header_datalen My Code…
-
1
votes1
answer74
viewsBubble Sort implementation error
Good afternoon to you all. At the moment I’m trying to implement Bubble Sort, the sorting method, but I’m having trouble printing the values, that these values are Andom, using the Rand function.…
-
1
votes1
answer70
viewsDoes the char vector have a minimum size?
I’m doing a huge job and he’s given a bug very strange when allocating vectors of char with specific sizes. After a lot of headache I decided to do a small test. #include <iostream> using…