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
-
3
votes2
answers20308
viewsHow to read a text file and take the values as integers?
I want to know how to read a file in c++. The first line has the size of the matrix and the other one has the elements of the matrix. Each element is separated by a blank space, there may be…
c++asked 10 years, 9 months ago Macario1983 1,335 -
3
votes1
answer171
viewsPrint Tableview Data with Qprinter
How can I get the data from a TableView add to layout html and print with QPrinter? Code: QString html; html = "<div>Titulo</div>" "<div>etc</div>"…
-
3
votes1
answer70
viewsFilter month on Qsqltablemodel
How do I filter the month on QSqlTableModel? I’m doing like this: model = new QSqlTableModel(this); model->setTable("tabela"); // db sqlite model->setFilter("strftime('%m',…
-
3
votes2
answers1301
viewsHow to open a C++ image using SFML?
I am still at the beginning and need to open a C++ image using SFML, at the moment I am using a code that uses the address of the image, but all this via code and what I need is that this address…
-
3
votes1
answer185
viewsWhy explicitly declare the base when calling function when using templates?
I have the following code: A derivative template calling a base function also template. template <int M> struct Base { void foo() {} }; template <int M> struct Derived : public…
-
3
votes1
answer197
viewsHow to link a class variable to c++ in lua script?
How do I access and set a class variable made in C++ passes to Lua? // C++ #ifndef SCRIPTSTORAGE_H #define SCRIPTSTORAGE_H #include "HTest.h" #include <luajit/lua.hpp> #include…
-
3
votes2
answers155
viewsConvert Qvector<Qstring> to int in C++
I have a Qvector and I want to convert it so I can make comparisons to find out which one is bigger. I tried to do this but it doesn’t work: QVector<QString> vector; std::atoi(vector.value…
-
3
votes1
answer111
viewsDoubt in dynamic memory allocation
In the code below, release B memory also releases from A? int* A = new int[4]; int *B = A; delete[] B;
-
3
votes2
answers276
viewsResize into dynamic pointer turns dimension into garbage
I was responding to an implementation problem of Std::stack. It was easy, but I couldn’t use my first idea: Std::vector (replaced dynamic pointers forever). My code is: template <class T>…
-
3
votes3
answers258
viewsAccessing an SFML pixel
I am developing a project where I must access pixel of an image and put them in a new matrix in RGB, for this I am using the SFML library, my difficulty is in logic, I know that a pixel is the…
-
3
votes1
answer857
viewsHow to make a window transparent using Qt?
I’m developing a college job in Qt. I would like to make the background of my application transparent. I did some research and the function I found was: this->setWindowOpacity(0); Meanwhile, the…
-
3
votes1
answer218
viewsC++ Dynamic Pointer Allocation
I am needing to create a protection routine in the removal function. Why it gives error when removing the last item? The function: // Remover o primeiro cliente void cadRemover(){ lista=ini; //…
-
3
votes2
answers2027
viewsSend a command to Terminal via C++
How to send a code to the terminal? For example: on a graphical screen where I type the name of a folder, and it sends to the terminal a mkdir NomePasta ? (Of course, there will be other features,…
-
3
votes1
answer721
viewsString to double C++ conversion
I’d like to convert a string passed to type value double. Example: string expressao = "1+1"; double x, y; Such that, x = expressao[0]; and y = expressao[1]; And the sum of x+y return 2 in response.…
c++asked 10 years, 5 months ago Ten. Oliveira 33 -
3
votes1
answer3965
viewsPrint vector disregarding repeated values
Make an algorithm that reads a 50-element vector and prints the vector disregarding the repeated values. The code is giving the correct output, but if I type a repeated number, the program requests…
-
3
votes1
answer1283
viewsHow to make a screen recorder?
I am wanting to make a screen recorder. What I thought to do was the following: From the recording event hit 30 screenshots per second and then join them in sequence to form a video. At this point…
-
3
votes1
answer196
viewsHow to use Qvector<Qvector <double> as matrix?
In the mainwindow.h have: private: QVector<QVector<double> > numbers; //Variável que será minha matriz public slot: void realizar_calcs(QVector<QVector<double> >…
-
3
votes1
answer561
viewsHow do I call a . dll and declare functions in C++. Net
I’m migrating a project to C++, but I’m having trouble calling . dll This is code: int LoadDLL (void) { char handle; //! Carrega a dll ... handle = LoadLibrary(L"c:\windows\system\minhadll.dll");…
-
3
votes1
answer183
viewsHello World in C++ does not compile
I am reading the book "C++ Language Training", but this teaching all wrong. The hello world of the book simply does not compile: #include <iostream.h> void main() { cout << "Primeiro…
-
3
votes1
answer265
views -
3
votes2
answers120
viewsReset variable
Is there any way to reset the variable without assigning all values again? ex: int number = 5 + rand() % 5 + 1; cout << number << endl; cout << number << endl; If the…
-
3
votes1
answer3148
viewsPalindrome in C++
The code below works, receives what was typed and stores it, only it does not make the logic to show whether it is palindromic or not and does not present on the screen the result for the user.…
-
3
votes2
answers1327
viewsQmake - Independent executable
How do I compile a Qt Creator program(.pro) with "static link"? I compiled by QT Creator, but I need to copy about 6 dlls to the executable folder, some of them are more than 100mb. I read in the…
-
3
votes1
answer170
viewsHow to change the background image of a Wxdialog?
How do I use an image like background of a wxDialog? Using the WxStaticBitmap, components do not appear right. I am using version 2.8.12 of Wxwidgets. Example of expected result:…
-
3
votes3
answers366
viewsHow to Record Data in Windows Registry?
I need to record data in the Windows registry in my application. How to work with Windows registry data handling using C++? What is the correct way to record new data in the registry without errors?…
c++asked 9 years, 10 months ago user17270 -
3
votes1
answer534
viewsHow to call a Python script in a C++ code in Qt Creator?
How do I call a Python script in a C++ code in Qt Creator?
-
3
votes1
answer1169
viewsHow to create an object with class template?
I have this code: Main.cpp Warehouse<Base<int>> arm(1, 1, 1, 1); arm.createSubBase(1,1,1); Warehouse. h private: vector<Base<T>*> whouse; public : void createSubBase(int,…
-
3
votes1
answer73
viewsQt return during release
When I compile my project as debug, it works normally, but when I try to compile in release appears the following message in the Output Compile: cc1plus: error: argument to '-O' should be a…
-
3
votes1
answer165
viewsBinary tree returning empty in search
In my menu it is not doing the correct output in the print. In addition to the search return only empty tree. #include<iostream> #include<string> #include<stdlib.h>…
-
3
votes2
answers1296
viewsHow to get operating system time in nanoseconds or milliseconds using Qt Creator?
How can I get system time in nanoseconds or milliseconds in C++ using the Qt Creator? For example, in Java use: long tempoInicial = System.nanoTime(); treinaRNAEpocas(10000); long tempoFinal =…
-
3
votes1
answer891
viewsHow do I update C++ to C11 on Ubuntu 14.10?
How can I upgrade the version of C++ to C11? Details: Ubuntu 14.10 32b GCC 4.9.1 (Ubuntu 4.9.1-16ubuntu6)
-
3
votes0
answers1928
viewsDifference of QT versus GTK+ in features
Before we begin some considerations: The object of this topic is to search for facts/objects, therefore assumptions/kicks/spreads will not be accepted as answers. All responses should take into…
-
3
votes1
answer114
viewsReturns the previous month of an informed date in Qt
How do I return the previous month of the date reported in Qt, has some function in the QDate what does it do? I just found the one that adds addMonths. Example: month 04 reported returns month 03.…
-
3
votes3
answers1501
viewsRead objects saved in.dat file
How should I proceed so that the reading function can read the arquivo.dat Every time I start the program? I am recording objects in a file, and I need to read them whenever the program starts.…
-
3
votes2
answers2775
viewsHow to send and receive a file via Socket?
I am needing to send files via Socket on C++ Linux, as the file may have an extensive content it will need to be sent in pieces. In this case, I need to create a kind of protocol to send a file (in…
-
3
votes1
answer802
viewsIs it possible to reverse engineer software developed in C++?
Is it possible to get the code from an executable developed in C++? Between Win32 Application and Windows Form Application, which ones can be decompiled?
c++asked 9 years, 7 months ago Jhonas Boeno 162 -
3
votes1
answer5340
viewsC++ write to files
#include <fstream> #include <iostream> using namespace std; int main() { ofstream f_out; f_out.open("teste.txt"); if(! f_out.good()) return -1; else cout << "Arquivo criado!";…
-
3
votes1
answer63
views -
3
votes1
answer134
viewsHow to customize "Notification Web API" in Qt?
I am creating a simple browser using Qtwebkit and added in it the "support" for Notification Web API using the QWebPage::setFeaturePermission. An example: function notifyMe() { if…
-
3
votes1
answer62
viewsHow does strtoull work?
I have tried anyway to understand what is the second parameter to use this function and it in general but I still can not understand.
-
3
votes1
answer115
viewsWhat is the difference between the quit and Exit methods of qApp?
I’m testing the example Getting Started Programming with Qt Widgets and found a call for a method to exit the application: void Notepad::on_quitButton_clicked() { qApp->quit(); } I took a look at…
-
3
votes1
answer4464
viewsRemove item from simply chained list
I’m having trouble removing an item by the value of a simply chained list. I’m doing so: class No{ public: int dado; No *next; No(int item, No *ptr= NULL){ dado=item; next=ptr; } }; class Lista{…
-
3
votes2
answers154
viewsAndroid studio has ndk support?
I will start development geared towards digital tv, and will be 50% ndk. Android studio meets well? or better eclipse?
-
3
votes1
answer224
viewsHow to make graphic applications in C and C++?
I’d like to know how to make apps with C and C++ GUI. I know logic, like if/Else loops, while, for, swith and while remain the same, but I would like to know how to make a window, button, and…
-
3
votes1
answer90
viewsWhat is a lightweight class?
I am looking for a concise explanation for this question a while ago. What I found were confusing and didactic texts.
-
3
votes1
answer391
viewsError Pointer to pointer in c++!
I created a Matrix class, to manipulate a matrix. In the class statement I have the following members (publicos): class Matrix{ public: unsigned char **mat; //ponteiro para ponteiro de uchar int…
-
3
votes2
answers1237
viewsHow can I get more accurate values by dividing two long?
I’m programming a CNC on my own, and I’m in the middle of my code, and now I have two variables like long which, when divided results in an exact fractional value, but the Arduino returning a…
-
3
votes2
answers403
viewsCommunication between C C++ ADDON and Nodejs
They are trying to implement a speech recognition server. But this last part has to be implemented through a C C++ Addon. Currently, I am saving the wav file to the server and passing the name to…
-
3
votes1
answer1489
viewsWhat command to delete partial in c++?
Well, how do you know system("cls") erases all, would like command to delete partially.
-
3
votes1
answer190
viewsFunction with nameless parameter
Why to declare a function with that signature? void funcao1(Pessoa&); void funcao2(Pessoa&,void*); void XN_CALLBACK_TYPE UserCalibration_CalibrationComplete(xn::SkeletonCapability&…