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
-
2
votes3
answers346
viewsHow to make a polymorphic pointer with the this pointer in the parameter?
For example, in Qt (correct me, if the logic is wrong, I haven’t touched Qt in a while), you can do this: QLabel label = new QLabel(this); Now let’s suppose: #include <iostream> class…
-
2
votes3
answers4604
viewsCount characters without empty spaces
I have to count the number of characters in a string, but when there is empty space it is counted as a character. How do I remove these empty spaces? Any tips?
-
2
votes2
answers110
viewsSorting does not work
I had to implement my own Sort, using Selection Sort. However, the simple code (I analyzed several times, and for me it is correct) gives strange results. template <typename T> void…
-
2
votes1
answer130
viewsInput bugging for no reason
I made a program that computes (by a DB itself using fstream) patients of a hospital. It has functions to output (one only for ostream using the iomanip and another to ofstream and fstream) and…
-
2
votes1
answer80
viewsBackground and icon on tableView
I wonder, how do I add in a tableView to the property of background and icone? I can already add the Background now is missing the icon. Code: class tableView : public QSqlTableModel { Q_OBJECT…
-
2
votes1
answer196
viewsHow to iterate for each character in a Std::istream?
In a std::string, the allocation is done so; in Chunks 128-character note. It takes every character from input and puts it by std::string::push_back. How can I do it? Note -…
-
2
votes1
answer335
viewsHow to make a Sorting in classes?
Funny thing is, that was an answer! The problem I have is this: I have a Person class, which initializes with a string, and it splits into a number and another string. After the class is mounted, I…
-
2
votes1
answer866
viewsCan I call one program inside another?
I want to connect one program inside the other because I have a project (main, 7 Classes) in C++/Opencv that should call a program also in C++/integrated with Tesseract, pass and receive an Object…
-
2
votes1
answer1150
viewsCoding in C++
Hi, I would like to know how to change the output encoding of C++, knowing that the default encoding is ASCII. I’ve tried with the libraries <windows.h> and <tchar.h>,in the following…
c++asked 10 years, 3 months ago Weslley C X Sardinha 1,427 -
2
votes3
answers237
viewsDifferent outputs on different compilers
I have this code: #include <iostream> int main(int x=1) { while (x <= 1000 && std::cout << x++ << std::endl) {} } I wrote it on Gedit, using Debian, and compiled it with…
-
2
votes2
answers1100
viewsWhy in the debug of C++ accented words and c cedilla appearing uncompromised?
When debugging the accented words they do not match. How do I correct this? Using Visual Studio. int main(){ int apples = 50; cout << "Há"<< apples <<"maçãs."<< endl; return…
c++asked 10 years, 1 month ago I Wanna Know 907 -
2
votes3
answers958
viewsUsing Visual Studio and C++ how to prevent the debug screen from closing automatically?
Using the code below I type the two numbers, but if I give enter after typing the second number the answer appears quickly and the debug closes. int main(){ int num1, num2, answer; cout <<…
-
2
votes2
answers4833
viewsHow to receive a char pointer via keyboard in C/C++?
How do I receive a pointer from char keyboard?
-
2
votes1
answer113
viewsMove square with mouse only on vector X or Y
I’m learning about the QgraphicsScene, QgraphicsItem I am trying to move two squares with the mouse in the window, but moving only in vector X or only in vector Y, but that they move only in one…
-
2
votes1
answer836
viewsError writing text file: cannot Convert Std::string to const char*
I’m not getting a record string on file .txt in C++ (Codeblocks). // aux é um inteiro // aux2 é uma string // foi dado fopen no arquivo...abaixo só segue a parte com erro aux = x.retorne_energia();…
-
2
votes1
answer245
viewsIs it possible to access the Hough transform accumulator using opencv?
I am with this small prolema, I searched a lot on the internet and in the documentation but I did not find anything related, I need to know what the accumulation value of each circle generated by…
-
2
votes1
answer63
viewsGet an X-size from a Picturebox?
I have a Picture Box, and in some part of the code I edit the horizontal size (x) of it, then further down in the code, I need to edit only the vertical size (y). I want the size of (x) to remain…
-
2
votes1
answer47
viewsHow to turn a cv::Mat into ipcMatrix<ipcRGB>?
Does anyone know if there’s an easy way to turn a cv::Mat in ipcMatrix<ipcRGB>?…
-
2
votes1
answer246
viewsImprove code to avoid slow particle collision
I need to divide space into cells. Each cell should be approximately the size of the particle radius so that a particle does not occupy more than 4 cells as in the illustration below: The r-ray…
-
2
votes2
answers517
viewsProblem loading file to memory
I am trying to load several files into memory (small file), but the problem is that when I try to load another file soon after, all the files get the same name as the last uploaded file. I am using…
-
2
votes1
answer426
viewsHow to debug in Code::Blocks using the VS 2010 Express compiler
I am using the Visual Studio 2010 Express. The problem is that Syntax Highlighting is very weak and the intellisense (feature that shows the attributes of objects in how much "you" type) also leaves…
-
2
votes1
answer691
viewsGet titles from open windows
I have a C++ program that arrives in a certain part that I need to check if a window is open, if it runs a part of the code. How could I take the windows open and do this check? I found a link that…
-
2
votes1
answer168
viewsWhat does Runtime dependencies of Objects mean?
What is the meaning of Runtime dependencies of Objects in object-oriented programming? I came across this question by studying C++.
-
2
votes2
answers975
viewsHow to get the directory the program is running?
I have an application running on the Windows platform. In one of my methods I need to capture the directory where the application is running, which is the correct way to do this?
-
2
votes1
answer1393
viewsVector struct and pointers
I have to pick up data (name and phone) of some people in a struct, then store them in an array, all this for a function/procedure. At the time of printing comes out some strange characters. I’m…
-
2
votes1
answer48
viewsSelect notes to be printed
I need to print only the notes above >=6, in which place of the code I put the if or some other instruction? I tried and I couldn’t find the right place. #include <iostream> #include…
-
2
votes1
answer463
viewsRun Lua code block inside C++
How do I run a Lua code block inside a C function++? The idea would be something like: int main() { tipodavariavel script; script << "print('Ola mundo')"; executar(script); return 0; }…
-
2
votes1
answer1909
viewsPrint values from a stack
I have to make a code that prints all values of a stack in the opposite order in which they were inserted, only I can only print one value at a time, each time I want to see the previous value I…
-
2
votes1
answer727
viewsWhat is the difference of implementing classes in C++ and PHP?
I am currently working in PHP and realized that when implementing classes I can’t just instantiate and then implement below the class using the scope selector ::. Example: class Lista{ public:…
-
2
votes1
answer1383
viewsHow to display a Double Chained Circular List
How do I display the values entered in a Double Chained Circular List? Follow my code with my attempt: #include "stdafx.h" #include <stdio.h> #include <iostream> #include…
-
2
votes1
answer190
viewsRead table in Lua through C++
I have a table in Lua this way: myTable={ one = {a=1, b=2, c=3}, two = {a=4, b=2, c=1} } The file has already been uploaded, as I do to read the table data through C++?…
-
2
votes2
answers984
viewsError compiling project in QT Creator
I am seriously wanting to study programming and I chose the QT framework when I was with a dualboot on my computer there was this problem that I am having now after removing the dualboot and install…
-
2
votes0
answers28
viewsStop C++ Dynamic Queue with negative value
I need to stop queuing when the user enters a negative number (-1) and print out all the entered values, how do I do this? #include <iostream> using namespace std; // Define a Estrutura Nó…
c++asked 9 years, 11 months ago Paulo Roberto 1,988 -
2
votes1
answer451
viewsObject and pointer allocation
How do you allocate a pointer, which points to a class, and an object? Is there a difference? Size, etc
-
2
votes1
answer99
viewsWhen including a header file, does the compiler include all functions in the final program or only the functions used?
That is, the executable will have the entire library in it or only the functions I use will be included by the compiler ? With this, including many libraries can make the program heavy (taking up…
-
2
votes2
answers197
viewsCreateprocess running EXE
I have an application, where the user uploads a file to the remote server, this same server when receiving this file should run this application. I’m using the Createprocess method. The problem is,…
-
2
votes2
answers1207
viewsReplace values inside string
How do I replace values within a string? To string will be something like: gabriel = 1.73,derp = 1.80, Take into account that this structure is: nome = altura, nome = altura,. In case, I want to…
-
2
votes1
answer3158
viewsHow do I make the message center and flash on the screen in C++?
How to make this message flash on screen, stay centered, and how to change the message color? #include <iostream> #include <cstdlib> #include <windows.h> using namespace std;…
-
2
votes2
answers4952
viewsHow to display "Press any key to continue" in C++?
In C, I put "Press any key to continue" with the getchar(). command in C++, as I do?
c++asked 9 years, 6 months ago Mateus Souza 647 -
2
votes2
answers183
viewsHow do I insert complex numbers into C++?
I know I’ve asked a question like this before. It was about Python. But in C++, how to insert a complex number?
-
2
votes1
answer126
viewsStoring SOCKET in a vector
I am working on a project developed in c/c++ where a server handles several connections, I do not have much experience in this language, I would like to know how I should proceed to add a SOCKET in…
-
2
votes2
answers1854
viewsHow to make so that after reading a file "txt" it read another one then
How to do after reading the file txt check if you have a next file txt, I know to read the file is enough: ifstream Arquivo; Arquivo.open("teste.txt"); while () { // leitura } After reading this…
-
2
votes1
answer572
viewsObject-Oriented Multithread in Native C++11?
How is implemented the Multithread Orientado a Objetos in C++11? in java this is possible through the Class Extension Thread / Implementation of the interface Runnable and overwriting the Run Method…
-
2
votes2
answers358
viewsDoubt about compilation in C/C++
I started studying the compilation of multiple files and I had a question. When we create a new header, we have to create another file with the implementation of the prototypes contained in the…
-
2
votes1
answer75
viewsLarge Number - How to get the value
I have that value v6[0] = 22; *(_QWORD *)&v6[1] = 42949672960069i64; Is there any way I can get the real value of this number? What should I know about reverse engineering ? How to compile this…
-
2
votes0
answers111
viewsHow to use Geolocation API with Qtwebkit?
It is possible to use Geolocation API with desktop applications using QWebView? I tried to Qty Webkit and HTML5 Geolocation, but it doesn’t work. I tried to it’s the Qt5 position api support for…
-
2
votes2
answers109
viewsAbstract type of variable
I have this line of code: USphereComponent * SphereComponent = CreateDefaultSubobject<USphereComponent>(TEXT("RootComponent")); How this kind of feedback works in my case (USphereComponent)?…
c++asked 9 years, 5 months ago Alexsander Borgesdamaceno 541 -
2
votes2
answers362
viewsIs it necessary to invoke the functions "Showwindow" and "Updatewindow"?
I recently made an introduction to Windows API and I’m already in the window-making part. In one of the first applications I created I had to use ShowWindow and UpdateWindow after creating a window,…
-
2
votes1
answer610
viewsSequential Static List
Guys look at this following code : lista is a struct lista * crialista() { lista *li; li = (lista *) malloc(sizeof(struct lista)); if(li !=NULL) { li->qtd = 0 ; } } because it was allocated lista…
-
2
votes1
answer453
viewsitt' is not recognised
I am trying to compile the code below with GCC 4.7.4, but always get the bug error: ạ itoa' was not declared in this Scope #include "otpch.h" #include <iomanip> #include <stdlib.h>…