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
answer177
viewsUnable to locate -lGL
I’m running the default Codeblocks code for Opengl on Ubuntu: /* * GLUT Shapes Demo * * Written by Nigel Stewart November 2003 * * This program is test harness for the sphere, cone * and torus…
-
0
votes0
answers52
viewsSingleton and Prototype Standard
I am developing a project where I came across the following situation: There are two families of algorithms that use a given object in different ways: the first just read the data and do a…
-
0
votes1
answer65
viewsInitialize members of a structure, accessed via pointer, in the constructor of a C++ class
Imagine the class DateTime as follows: datetime.hpp: #ifndef DATETIME_HPP #define DATETIME_HPP #include <ctime> class DateTime { public: DateTime(); DateTime(int, int, int, int, int); private:…
-
0
votes1
answer90
viewsProblem with Segmentation fault with whole pointer
The program below attempts to reproduce a cellular automaton model. When I use "n" (number of cells) above 65 thousand, the program returns Segmentation fault. I tried to "print" some text in…
-
0
votes1
answer143
viewsWhy do these two identical codes, one in C++ and the other in Java, give different results?
I’m trying to solve an issue in the URI Online Judge in Java but I’m afraid of 5% error, and what I’ve studied is being caused by the fact that the accuracy of variables in C++ and Java is…
-
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
votes0
answers79
viewsGetline reading, not le a string and tb when accessing an array that does not exist or size insufficiency
Well, that’s a player rating of a game of two-on-two, where it ranks the match in which it stopped. #include<iostream> using namespace std; int main() { int…
-
0
votes1
answer174
viewsHow to fix the error: "declaration of template Parameter’T' Shadows template Parameter" in C++?
I’m trying to do a Polygraph program, but I’m having a problem... My code and this: main.cpp: #include "point_2d.h" #include <iostream> int main() { cge::point_2d p(5, 5); p.x = 6; std::cout…
-
0
votes0
answers3097
viewsMemory identifier is not defined
The script would basically be this. #include pragma comment(lib,"user32.lib") DWORD WINAPI th(LPVOID param) { while (TRUE) { if (GetAsyncKeyState(VK_F1) & 1) { Memory mem = new Memory(); DWORD…
c++asked 6 years, 1 month ago Gabriel Martins 1 -
0
votes0
answers42
viewsOrganize chained list
Hello I’m trying to organize a simple chained list but I’m losing the nodes reference, if you can give me a light... For example, if the previous node has the attribute "->date" larger than the…
c++asked 6 years, 1 month ago Raythan Machado 33 -
0
votes1
answer260
viewsIs it possible to send data in the body and in the url using the PUT and libcurl method?
I’m trying to send the data both in the URL and in the body using PUT the idea was to make it work exactly like the POST method, but being the PUT method. This is because I see many requests where…
-
0
votes1
answer81
viewsHow do I make a circle jump up and down when I press into space?
I need to make a version of the game "Color Switch" in Visual Studio C++ with Glut but I don’t know how to make a geometric figure move. Any help is welcome. Below is the code of my circle #include…
-
0
votes1
answer358
viewsError: E0254 type name not allowed
I’m getting this error in this code: bool Configuration::GetConfigBlockLine(ifstream& file, string& key, string& value) { string line; // end of file while( !file.eof() ) { // read line…
-
0
votes0
answers35
viewsC++ Screen position gets weird when I try to convert from Getcursorpos to Sendinputs function
I used the function GetCursorPos to pick up positions on the screen I would like the mouse to be able to click to perform a task for me and automate the service. I tested selecting these positions…
-
0
votes0
answers40
viewsHow to insert a number into an arbitrary position, into a position I want?
Hello, all right? I have this code and I need to know how to insert a value in an arbitrary position, I tried in a few ways, but I couldn’t. Follows the code: #ifndef LIST_H #define LIST_H…
-
0
votes1
answer73
viewsProblem Running Watershed Distance Transform in Opencv 4.0.0
I am working on an object detection project. I use Opencv 4.0.0 and codeblocks 16.01 on Ubuntu 18.04.1. I am testing the Watershed Distance Transform technique using the code of this tutorial:…
-
0
votes1
answer63
viewsHow can I find the gpu and cpu name in Qt c++
Any of these solutions suit me, I first tested a system management code to try to find the name of the gpu and cpu, but give this error to me in visual studio, the compiler seems not to accept clr,…
-
0
votes2
answers335
viewsSearch for words in almost 1 million files
I am looking for methods/ideas that can help me to solve my problem. I have a structure of folders / files that my program generates, so far so good. But what happens is that this folder already…
-
0
votes0
answers214
viewsOpencv 4 at Visual Studio 2018
I’m trying to use the Opencv library in Visual Studio, but I get the following error message: LINK : fatal error LNK1104: cannot open file 'opencv_calib3d400.lib' The lib is in place C: opencv4…
-
0
votes2
answers324
viewsPointers per parameter in C++
I’m having a problem with the pointer on customers. I call the function newCustomer(), that inserts nodes in the list hanging on customers. The problem is that every time the program leaves the…
-
0
votes2
answers113
viewsProblem with C++ code
I was writing a code and I stagnated on some problem along the way. Follow below for more details: Enunciation Afonso is in line to buy tickets to his concert favorite band. Afonso is at the end of…
-
0
votes0
answers87
viewsInclude of file . h is not enough to create a class instantiation
I created a class called Board, make the prototypes in the file Tray. h and keep the code on Board.cpp, during the study I saw that just adding the Tray. h at the index.cpp would already be possible…
c++asked 5 years, 9 months ago Kaue Alves 303 -
0
votes1
answer430
viewsHow to use Cmake to compile a project with multiple libraries
I’m trying to develop a game in OpenGL, but the IDE I use makes use of the CMake and I’m not getting to set up the project. I’m totally lost. I searched several tutorials of Cmake on the internet,…
-
0
votes1
answer78
viewsWhen the input is greater than 9 the program reads only the first digit
When the user enters with a larger number, such as 13 or 28, 50. the compiler understands that it is being typed 1.2 and 5 respectively. how do I fix this problem ? /*EXERCÍCIOS UTILIZANDO O CAMANDO…
c++asked 5 years, 8 months ago Vitor Lima 25 -
0
votes1
answer33
viewsList code not compiling well
Hello. I’m trying to learn about pointers and lists and I made a code that contains a menu and the option to enter as many values as I want. I made the code in the most recent codeblocks using W10…
-
0
votes1
answer985
viewsHow to print a string in C?
I’m studying C and I want to make an algorithm that reads the names of 30 students in a class and returns the highest grade, lowest grade and the names of these students. I have already researched a…
-
0
votes2
answers67
viewsCmake accuses multiple statements of a class
Structure of the "project": ->shop ---->cpp store. ---->shop. h ---->main.cpp ---->Cmakelists.txt When I try to compile Vscode accuses that there are multiple denifications of class…
-
0
votes0
answers249
viewsJunk in memory when printing vector backwards
02 - Create an algorithm that asks the user to enter its name and store in an array, the program must store in another vector the name written backwards. At the end, the two vectors should be…
-
0
votes1
answer376
viewsError in income tax program in C
I developed the following program in C for an income tax calculation of employees of a company #include <stdio.h> int main(){ //Declaração de variaveis int depen,cont,a1=0,a2=0,a3=0,a4=0,a5=0;…
-
0
votes1
answer141
viewsError when compiling a solution in c++ in visual studio 2017
I’m trying to compile a c++ solution, but it’s not working. Can someone help me? I opened a visual studio 2008 solution in visual studio 2017. When I give the build the error happens. I did not find…
-
0
votes1
answer56
viewsDoubt in activity with POO
Hello, basically the exercise is to have the user type numbers in an array and then I have to have the array separated into another 2 : one for pairs and the other for odd ones. I’ll leave the code…
-
0
votes1
answer382
viewserror: expected Primary-Expression before = - Error during object creation:
NOTE: My teacher is teaching modularization in c++, so the files are all divided. I am trying to implement point2d class, but when I try to compile the file by linux terminal, these errors occur:…
-
0
votes1
answer136
viewsProblem with while C++
I’m starting to learn programming in C++ and I’m having trouble solving an exercise through repetition. The exercise has such a statement: Make a program that reads 5 integers. The program must then…
-
0
votes0
answers87
viewsDoubt - Map operation in C++
In order to compare different pairs of shoes I created a map, the first int represents size and the char represents whether it is for the left or right foot ('e' or’d'). N represents the number of…
-
0
votes1
answer97
viewsError message "wntdll.pdb not Loaded" when creating a virtual destructor
I was trying to create a virtual destructor for a class, however, when trying to compile the code below in 'Debug' mode, Visual Studio 2017 stopped running the program, reported that an exception…
-
0
votes2
answers199
viewsError in c++ stringstream write function
Expensive, I am doing a function for decimal to binary conversion, which is returned in a string. As C++ does not have StringBuffer, I’m using the stringstream. However, I always have build error…
c++asked 5 years, 7 months ago Daniel Elias 27 -
0
votes1
answer85
viewsDevelopment of a C++ canteen
I have a university project that I was asked to create a canteen in which I was asked to create groups of students / staff to add to the queue. Groups can have 1 to 10 members . The problem here is…
-
0
votes1
answer129
viewsHow to play queued audio on SDL Mixer and C++?
I have 4 different audios; I want to play them in a row, press a button and tap 1; when it finishes playing it automatically it starts playing 2, then 3 and then 4.... you can do this in the SDL…
-
0
votes1
answer42
viewsBubble not changing list values
When I run the first consultList() data is shown in the console, however, after executing the bubbleSort() the query does not display the data. Follow the code below: #include <iostream>…
-
0
votes1
answer127
viewsProblem C++ LNK2019 error
Gravity Code Description Project Path File Line Deletion State Erro LNK2019 símbolo externo indefinido "public: void __thiscall Shop::ButtonScroll(short)" (?ButtonScroll@Shop@@QAEXF@Z) referenciado…
-
0
votes1
answer144
viewsURI 2399 5% C++ error
Guys, my code is giving 5% error and I can’t find a why, it’s the question of the minefield: #include <iostream> using namespace std; int main(){ int N, i; int qtbombas; cin >> N; int…
c++asked 5 years, 6 months ago Marcelo348 9 -
0
votes1
answer34
viewsTransform only ascii numbers 0-9 to int
I have the following code string t_postfix = getPostfix(); Stack<int> operandos; //pilha dos operandos for(int i=0;i<n;i++){ //loop para pegar operando e realizar operações…
-
0
votes2
answers62
viewserror when compiling C++
hello, I’m trying to compile a C++ program for a college job plus every time of the error in the printf, including I put the same code in devc++ and persist, someone can help.…
c++asked 5 years, 6 months ago Douglas Bertoldo 21 -
0
votes2
answers199
viewsHow to remove white space on a vector pointer?
I have a data entry where the user will enter a certain amount of char, this quantity comes from the first entries of the size of the vectors according to the user’s choice... How the input of…
c++asked 5 years, 6 months ago user148754 -
0
votes2
answers820
viewsC program does not correctly read a . txt file with integer numbers
I’m with this C code where the goal is to read 25 whole numbers of a text file and store them in a 5 by 5 array. The problem is that when running on MS-DOS, the program prints only junk from memory.…
-
0
votes2
answers72
viewsC program does not read values in txt file
Guys, I’m back again. I applied some changes that the members here suggested in another post, but the values are still not read correctly. Now gives up to integer values (before DOS printed negative…
-
0
votes1
answer193
viewsC++ Compiling/Including all files . cpp from the subdirectories of the /src folder
I use Visual Studio Code + Mingw. My project is the https://github.com/KaueAlves/Grimorie-Tabuleiro As some IDES link between classes automatically, when using VSCODE I came across the need to pass…
-
0
votes2
answers942
viewsHow to make my function Len() return the size of Std::string, vector and const char *?
My job len() in C++ can return the size of std::string and of std::vector<std::string> but cannot return the size of const char *, 'Cause for that or I’d have to use strlen() or convert const…
-
0
votes3
answers246
viewsRead and print struct values
I have an algorithm that reads name, sector and number of 10 employees, I’m trying to read in a function but I’m not succeeding, when I try to print only out numbers. This is a piece of content that…
-
0
votes1
answer50
viewsVector issues using intel’s C++ compiler in Visual Studio
The code below is the result of a work I am developing, basically it is the multiplication of a square matrix, however, the results I had parallelizing the application with the Openmp API were…