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
votes1
answer79
viewsExplicit conversion with "static_cast" does not occur
According to the C++ How to Program, 8th ed., during the operation of two numbers (e.g.: 10/3) the fractional part of the resuscitation is lost before it is stored in the variable . For this to be…
c++asked 9 years, 4 months ago Heidy Miguel 121 -
2
votes1
answer1145
viewsCompiling with g++
I am compiling an example code provided on the GLFW bookstore website as follows: g++ main.cpp -o main.exe glfw3dll.a <- this way it is possible to compile, but what if I want to change the files…
-
2
votes1
answer95
viewsCryptography does not read spaces
Well, I’m trying to encrypt a text file with the following "program": #include <iostream> #include <fstream> using namespace std; void writeFile(char* filename, string str){ ofstream…
c++asked 9 years, 6 months ago Gabriel Sales 1,257 -
2
votes1
answer2918
viewsStudent Queue. Help in structuring code
My doubt is in the case 1, how to include items in the queue, in case, mat and media. Follows code below: #include <iostream> #include <cstdlib> #define tamanho 20 using namespace std;…
-
2
votes1
answer116
viewsTemplate error when returning value
I am implementing a class that represents an array using template and dynamic allocation. However, when the +(addition) operator was overloaded, the following build error occurred (only when I try…
-
2
votes1
answer2339
viewsCheck if a variable is numeric or string
Good afternoon, Is there a function in C++ that checks whether the variable is a string or numeric? An example is: In PHP use is_string(variable) or is_numeric(variable).
-
2
votes2
answers72
viewsCode compilation
Guys help me, I can’t compile this code: Until starts the command screen no more runs #include <stdio.h> int main() { int x,y,z; int a=0; for (x=0;x<=1;x=x+1) for(y=x;y<=1;y=y+1)…
-
2
votes2
answers704
viewsPointer operators passing by reference
I’ve been studying some codes I found on the Internet, and one of them used a prototype implementation as follows: void changeMode(Mode &m){ m.loop = true; m.quit = false; } See that function…
-
2
votes2
answers197
viewsHow to import user32.dll and others into C#?
I found several and various results on the internet teaching to import a specific function from user32.dll. But I can’t get out of my head if someone hasn’t done a project with all the imports…
-
2
votes1
answer761
viewsC++ class with multiple constructors - Header and cpp file
I have a C++ class where I have two constructors. In the file minhaclasse. h: public: MinhaClasse(int x1); MinhaClasse(int x1, int x2); Then in the.cpp file I create normally the constructors I…
-
2
votes0
answers246
viewsPath in C++ Binary Tree
I’m solving this exercise : http://br.spoj.com/problems/PREEMPOS/, but I do not know the logic of, from the result of the search in a tree of pre-order and order, arriving at the result of…
-
2
votes2
answers1348
viewsHow to show the largest number typed, using functions?
#include <iostream> using namespace std; void maior(int a, int b); int main() { int cont, maior1; do { cout << "digite um valor: "; cin…
-
2
votes1
answer266
viewsIs this Bubble Sort correct?
People I’m reading book "Programming Principles and Practice using c++ (2nd Edition)" from C++ creator. There is an exercise there at the very beginning talking to do a program that sorts the data…
-
2
votes2
answers126
viewswhile code does not make the correct condition
I need to create a code that reads only one double and register in two variables the "smallest so far" and the "biggest so far", I can even complete a cycle successfully but after that it prints out…
-
2
votes1
answer2024
viewsProblem using getch() in C
I’m writing a simple game that relies on crossing a number in the first element of the matrix to the last element. However, I’m willing to use the function getch() so that the element moves through…
-
2
votes1
answer266
views"Undefined Reference" in the constructor of a C++ function
I am creating a VS1838B name class that is composed by other instances. This is the class header: #ifndef INFRAREDRECEIVERVS1838B_H #define INFRAREDRECEIVERVS1838B_H #include "Arduino.h" #include…
-
2
votes1
answer50
viewsUse Method of a class defined in a executable
You guys all right? I am here implemented some features to a game server, I own the PDB file in which I can search the OFFSETS. I was able to reference the global functions by OFFSET this way :…
-
2
votes1
answer307
viewsWhat is the difference between Qstring and Qstringliteral?
What is the difference between the two? What is the best to use?
-
2
votes1
answer623
viewsDecomposition into primes
Hello folks I’m learning C++ for Data Structure subject and there is some error in the code that is creating an infinite loop. #include <stdio.h> int fatores(int a[], int n, int *x) { int…
-
2
votes0
answers103
viewsProblems with Opencv - Eyes Cascade and Face Cascade
Hey! What’s up? I am making a program in C++ with Opencv and when running appears the error below This is the error that is occurring without Try-catch This is the error occurring with Try-catch int…
-
2
votes1
answer2466
viewsEmpty list matrix initialization "{ }" in C++
From what I have seen, it is possible to initialize a vector with the empty list, in C++, but not in C, so that all vector elements are 0: int meuVetor[10] = {}; // Todos os elementos 0, em C++ What…
-
2
votes1
answer2561
viewsHow to make an array of objects?
How to make a array of objects? I am trying but am not succeeding, returns me an error: line 26 [Error] no match for 'Operator[]' (operand types are 'Time' and 'int') Code: #include <iostream>…
-
2
votes1
answer75
viewsThe program skips a line of code ahead
When I run the program below, do not ask me for the name of the malfunction and jump to the description. void gestor::addavaria() { setlocale(LC_ALL, "portuguese"); int opc; string descricao; string…
c++asked 9 years, 1 month ago kingwarrior05 617 -
2
votes2
answers161
viewsC++ program communication with a C#
Good people, I’m going through a little problem, I have an application in c++ and I have to make the output of it read by a program made in C#. would you like to know if there is any way to do that?…
-
2
votes0
answers78
viewsReuse of threads
I’m making an addon for nodejs. One of the functions is responsible for parameterizing the incoming audio, from the various clients. I want this parameterization to be done in a thread. void…
-
2
votes1
answer150
views -
2
votes1
answer364
viewsHow to know if three points are clockwise or not in C/C++?
Given three points P1, P2 and P3, what is the best way to know whether this order is clockwise, counterclockwise, or neither (the three are collinear)? For example, in the image below the dots are…
-
2
votes1
answer73
views -
2
votes1
answer246
viewsProblem to assign more than one value to variable
#include <stdio.h> int main(){ int d; int e; int peca1; printf("digite um lado da peca: "); scanf("%i", &d); printf("digite outro lado da peca: "); scanf("%i", &e); peca1 = d , e…
-
2
votes1
answer114
viewsCount the height and width of an "image" (char* using n) - C++
Good evening! In one of the parameters of my builder, I am passing the following char * +---+\n|A |\n| H |\n| A|\n+---+ Then the constructor calls Settext(), passing that char*, and inside…
-
2
votes1
answer81
viewsJava function equivalent to the c++ map()
There is a function for java, equivalent to map() of c++? Basically it calculates the ratio between the values "minimum" and "maximum".…
-
2
votes1
answer104
viewsProblems with uint64_t in C++
I have a problem with very large numbers. When I put the input 64 my program does not display the right answer, remembering that all smaller numbers are with normal output. Exit from the program: 0…
-
2
votes1
answer145
viewsC++ run secondary program, only if the command is typed
int main() { system("F:\\AI\\iapt2.exe"); system("pause"); return 0; } Good evening, I have this code right, it will open the program iapt2.exe when running, however I would like to insert an…
c++asked 8 years, 5 months ago Luan Barbosa 31 -
2
votes1
answer564
viewsGrayscale in Images - OPENCV
Good afternoon Personal, I have an image . bmp and want to turn it into grayscale (0-255), through Opencv with C++(I don’t want to save this image in grayscale). From there, I want to go through the…
-
2
votes1
answer55
viewsIs there a replacement for _outp, removed in Visual C++ 2015?
I’m migrating an MFC project from Visual Studio 2010 to 2015. In the process I discovered that the _outp, among other commands, has been permanently removed. In the MSDN (_outp, _outpw, _outpd)…
-
2
votes1
answer794
viewsHow to generate Adjacent Matrix of a BFS from a txt file? C++
I’m using the Codeblocks. I have a. txt file that represents a maze, everything that is after the : are rooms: The first line of the file shows the start coordinate, which in this case is AS. Every…
-
2
votes2
answers292
viewsHow to reuse a pthreads?
I’m using pthread.h and using the following functions: // // Cria A thread // thread_argsPP[contthreadsPP] = contthreadsPP; pthread_create(&threadsPP[contthreadsPP], NULL, ReceivePinPad, (void…
-
2
votes1
answer265
viewsClass functions hook (offset)
I don’t know the right way to explain this question, but I’ll try it my way. I have an app. exe and I need to create some customizations for the executable, so I created a DLL and gave hook for the…
-
2
votes2
answers207
viewsInteger combination command. C++
Is there a command that allows the combination of two integers? I have a variable that counts 5 and one that is worth 6 for example, there is some command that makes it possible to play the…
c++asked 8 years, 4 months ago Evandro Ferraz 107 -
2
votes3
answers1174
viewsConversion of variables type int to char*. C++
I have the following method that takes two int variables as parameter and I need to concatenate these two values into a char variable*, only for this to be possible it is necessary that these two…
-
2
votes0
answers53
viewsProblem following tutorial on MSDN Winusb, Microsoft
I have encountered problems in following the Microsoft MSDN tutorial on Winusb. The tutorial is Write a Windows desktop app based on the Winusb template. Following the instructions, in the step…
-
2
votes1
answer2162
viewsShow a specific number of decimals in floating point numbers in Lua language
I started to learn a little about the language Lua and I’m doing some algorithms to practice and one of them I should show in the output of floating point values with 4 decimal places. In C++ I…
-
2
votes1
answer307
viewsWhy in set methods in C++ do I have to use the parameter as a reference?
I took this class Pessoa as an example: public class Pessoa{ private: string nome; public: string getNome(); void setNome(const string &nome); }; My question is: why should I use a parameter by…
-
2
votes1
answer172
viewsSPOJ returns "Wrong answer" to seemingly correct solution
I tried to solve the problem BANCO12 - Bank SPOJ, but when submitting my C++ code, the system returns "wrong answer". Follow my code: ` #include <iostream> using namespace std; int main(){ int…
c++asked 8 years, 8 months ago Felipe Regino 65 -
2
votes1
answer316
viewsQuicksort with last element as pivot
The following code should receive a sequence of characters separated by space and sort them: #include <stdio.h> #include <stdlib.h> int particiona(int *vector,int inicio,int fim){ int…
-
2
votes1
answer63
viewsIs there a way to create a private class in C++?
I wanted to create a class where it could be accessed in the library that I created, how do I declare the class as private and can be called only in the library?
-
2
votes1
answer508
viewsUpdate console without using system("cls") on Windows
I am creating a text game, where will have an initial menu, follow the code I already have: #include <iostream> #include <Windows.h> using namespace std; void setTamanhoConsole(int x,…
-
2
votes1
answer55
viewsMultiple Cmake in one project
I am developing an application in C++, where I need to use a library I have developed before with Cmake. But I don’t want to call the binary directly because each platform will have to have a binary…
-
2
votes1
answer109
viewsLibrary similar to Boost and STL in C
Is there a library similar to Boost and STL C++ with data structures, etc., in C?
-
2
votes1
answer234
viewsIntegrate C and C++
Good morning, everyone. I have a main program in C, and I just want to call a function that is in another C++ file and get the return of this function. How do I do that? I researched and saw that…