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
answer995
viewsToo Many Arguments to Function 'address* finds()'
I am trying to compile this code in Devc++ but keeps giving this error [Error] Too Many Arguments to Function 'address* finds()' #include <stdio.h> #include <stdlib.h> #include…
-
2
votes1
answer69
viewsConversation from hexa to int and toupper do not work
I need help with this code because I believe three functions however hexToInt function is not properly converting only works conversation if hexa is an integer type 19 and not A or 1D. and the…
-
2
votes0
answers36
viewsInaccurate value when calculating with float
Rest is giving 0.72998 and not 0.73 why? using namespace std; int main() { float num=576.73; int x=num; cout<<"x "<<x<<endl; cout<<"num "<<num<<endl; num=num-x;…
c++asked 7 years, 11 months ago Victor Figueira 21 -
2
votes1
answer420
viewsProblem with operator overload
Errors occur when I step the class object Name_pairs by the exit operator << and by the comparative operator ==. Header: class Name_pairs { public: void read_names(); void read_ages(); void…
-
2
votes2
answers909
viewsHow to use Operator= to copy a pointer vector?
Having this class, I would like to implement, operator =, copy the pointer vector to int for another vector, it is obligatory to reserve memory before doing so? What’s the difference between making…
-
2
votes1
answer195
viewsSearch text in a String as a "like"
I want to do a text search, like the ones I do in Mysql. Ex: LIKE "9%4" I tried to implement a find_if(), but without success. #include <iostream> #include <string> #include…
-
2
votes1
answer559
viewsIs there an insertion method for binary tree search faster than trivial?
I’m trying to solve this problem in an online Judge. The problem provides N integers that must be inserted, in the given order, into an insertion algorithm of a binary search tree. After Q queries…
-
2
votes0
answers54
viewsProblem with SFML in Code Blocks Windows 32 bits
I installed SFML in Codeblocks using the instructions here http://www.sfml-dev.org/tutorials/2.0/start-cb.php So I compiled the sample code from there, which should display a window with a green…
-
2
votes1
answer320
viewsparameters for function : const reference and constant data pointer
what is the difference in performance ( in the case of large object) the calls below: void funcao( const tipo &objeto ) and void funcao( const tipo *objeto ) I know that the first receives a…
c++asked 7 years, 10 months ago Andre Luiz 115 -
2
votes1
answer46
views"SIGSEGV" error when receiving a large data packet
Hello, I am facing a "SIGSEGV" error when receiving a large data packet with the recv function of the library using C language on a Posix - UNIX system, if any soul can help me a thank you. buffer:…
-
2
votes0
answers44
viewsMongo(3 shards) C++ Driver: Syncclusterconnection error
I’m having trouble running the upsert on Mongo when I connect to 3 shards on cpp. Now when I connect in just one of the shards I can do the operation. Does anyone have any alternative or knows the…
-
2
votes1
answer618
viewsEuclidean Division
There is a problem of Euclidean division in which the rest r cannot be greater than the b, following the theorem a = b.q + r. I made a code and got one accepted, but I found one better than mine!…
-
2
votes1
answer326
viewsHow do I stop a for loop that stores the values of strings typed in C++?
So I’ve tried everything I’ve tried to compare type typed a "." or set a limit value and even then the program does not continue, it stays inside the infinite loop. The code comes next:…
-
2
votes2
answers896
viewsStruct or Classes, huh?
I made the code using structure, I wanted to know if with classes it would be more efficient. I’m doing it in C++ Builder. The idea of the code and the following: create a list of problems, where…
-
2
votes1
answer90
viewsWhat’s wrong with my show?
I am trying to better understand the functioning of pointers in C and C++ and for this I am trying to make this small program of chained lists (I took the example of the book "Data Structures" of…
-
2
votes2
answers828
viewsHow to connect a Mysql database with QT on a local network?
Hello, at the moment I am Noob in manipulation of servers with databases. I am using Qt Creator 5.3 to develop my project, and have decided to incorporate a Mysql 5.7 database into it. I am trying…
-
2
votes2
answers2074
viewsDynamic matrix allocation in C++
I would like to dynamically allocate this matrix in C++: int main() { int n,m; cin>>n>>m; if(n>m){cedula tabela[n][n];} else {cedula tabela[m][m];} return 0;} but the code does not…
-
2
votes1
answer874
viewsHow to store letters in a variable and display them all at the end by forming a phrase/word
I’m holding up programming and I’m making a code where I’m supposed to turn a binary code into a phrase. I’m turning the binary value into decimal, and taking the decimal value and comparing the…
-
2
votes1
answer563
viewsc++ - How to return a value to a previous window in Qt?
Hello, I am developing a project where I will have many calls from new windows and need to recover a value from these windows to the main window (Mainwindow). The problem is that it becomes…
-
2
votes1
answer1039
viewsC++ - Convert Mat to Opencv integer array?
I’m doing an image manipulation project using the Opencv. I need to analyze the values of pixels of a "binarized" image, for this I am trying to convert my Mat file image to a array of integers,…
-
2
votes1
answer937
viewsHow to compile . cpp codes that have separate interfaces and implementations in g++?
I’m studying C++ for the book Deitel, and I’m trying to compile a program where we have a file gradebook.h which is the interface, gradebook.cpp which is the implementation and…
-
2
votes1
answer56
viewsHow to create a "defnine" with undetermined arguments?
I’ve seen somewhere for some time that this was possible, and now I need to implement this to make it easier to read the code. Is the following : void A::adicionarTodos () { lista.adicionar(A1::id);…
c++asked 7 years, 7 months ago Rodrigo Santiago 1,822 -
2
votes1
answer540
viewsInsert in Tree B with a large number C/C++
I need to build a B Tree that reads the name of the files in a folder and sorts them. "Create a repository of images(100 images with 5 of each category-ex: trees, boat, dogs, houses, computers,…
-
2
votes2
answers1461
viewsRead a txt file and place each character in a position of an array in C
I tried the code below, but it didn’t work The big problem is fscanf placing each character of the text in an array position #include <iostream> #include <stdio.h> using namespace std;…
-
2
votes3
answers95
viewsHow to search a string for X and replace it with a number and use it to calculate?
I’m creating a C program to do the Newtow-Raphson method, it should automatically calculate for the person. But in one part of the method should be done the automatic substitution of values in the…
-
2
votes1
answer416
viewsPointer to pointer array
I wonder if in the code below (the variable 'p') is a Pointer to an Array of Pointers ? #include <stdio.h> int main () { double valor = 7; double *balance[5] = {&valor, &valor,…
-
2
votes2
answers96
viewsC++: File header not recognizing class
I am working with several classes, and to organize myself better, I put each class in a different file. actor. h #ifndef ACTOR_H #define ACTOR_H #include "SDL.h" #include <string> #include…
-
2
votes1
answer865
viewsPython to C++ conversion
I work on my course with C++, and wanted to use a Python class variable access feature. See an example: class Telefone: nums = {} def __init__(self, numero): self.num = numero Telefone.nums[numero]…
-
2
votes1
answer110
viewsPrinting a vector... Differences between C++ and C... Where did I go wrong?
I’m having problems printing vector structs in C, in C++ it worked... First I will show the version in C with problems (in the execution because compiles without errors) CACHE cache =…
-
2
votes1
answer42
viewsIs it possible to include dynamic libraries in a static?
The final goal is very complicated, I will try to explain as much as possible : There is the file libA.so and the file libB.so , both are required to use my own library code libC, which I would like…
-
2
votes2
answers186
viewsWhy do you accept values beyond the size of the vector?
INT vetor[3]; vetor[0] = 110; vetor[1] = 12; vetor[2] = 30; vetor[3] = 13; vetor[4] = 1; Cout << vetor[0]; Cout << vetor[1]; Cout << vetor[2]; Cout << vetor[3]; Cout <<…
-
2
votes1
answer92
viewsAlgorithm for AST
I’m creating a programming language in C++. I’ve made a simple lexer, which works perfectly for now. out 5 + 7 * 3 My lexer turns it into: kw: out num: 5 op: + num: 7 op: * num: 3 nl Now I need to…
-
2
votes1
answer3318
viewsHow do you use Cin.get() in C++?
i would like to know more about the Cin.get() function and also the difference between it and the getline() function because whenever I research something related to it I see more search results…
-
2
votes2
answers566
viewsHow to implement operator overload << and >> in C++?
Hello, I’m doing an exercise consisting of the following statement: Sorry to put a print, but I could not select the text and it would be unnecessary to type everything here. Finally, I made the…
-
2
votes2
answers143
viewsOverload of C++ operators, is the auxiliary variable necessary in this case?
I am studying for the book Introduction to Object-Oriented Programming with C++ (Antonio Mendes da Silva Filho), and implemented an example of it as follows: #include <iostream> using…
-
2
votes1
answer83
viewsC++: Compile using Batch
I’m using cmd to program, and I want to make a batch file that automates the build process. I want him to Compile the files using the command g++ -c ./scr/Nome.cpp -o ./obj/Nome.o -std=c++1z This…
-
2
votes1
answer612
viewsWhat would be Pro*C/C++?
From what I saw it is using in Oracle, but I can use with another Bank? Pro*C/C++ useful these days? Could pass a Code Example? Does it differ from PL/SQL? Or are they used together?…
-
2
votes1
answer113
viewsOpencv: How to import automatic lib
Good morning, I’m starting programming with Opencv in C++ with Mingw, but I’m having trouble with lib files. Every time I need to compile a program, I need to put, for example,…
-
2
votes1
answer76
viewsError: argument of type char is incompatible with lpcwstr
#include <iostream> #include <Windows.h> #include <TlHelp32.h> DWORD getbaseadress(DWORD Pid, TCHAR* n); using namespace std; int main(int argc, char* argv[]) { HWND hwnd = 0;…
-
2
votes2
answers248
viewsWhat is the best method to access a class member?
What is the best method to access a class member for speed and organization? class cMinhaClasse { public: void Funcao(int r); }; int main() { // Método 1 - Acessando classe por ponteiro cMinhaClasse…
-
2
votes2
answers136
viewsHow does -O3 optimization break some programs?
When compiling my own programs, I have the freedom to change some flags compiler and start using optimization -O3. This optimization manages to break some programs. I understand that the compiler…
-
2
votes2
answers68
viewsIF always gives me the same answer!
#include <iostream> using namespace std; int main(){ int x, bebida; cout<<"Digite 'bebida' "<<endl; cin>>x; if(x == bebida){ cout<<"Esta certo"<<endl; } else{ (x…
c++asked 7 years, 1 month ago Robson Lima 35 -
2
votes2
answers822
viewsHow to delete the last line of a text file in C language
Guys, I’m having a question about how I should delete the last line of a file using the C language. Could someone please help me. Below, follow my code. int quantidadeDeUsuarios = 0; Usuario…
-
2
votes1
answer1325
viewsPassing objects by c++ reference
Talk guys, I’m trying to learn a little C++ and I have a question regarding the passage of objects to a class and manipulation of it within this one. I can do this in C#, but I’m trying in c++…
-
2
votes1
answer64
viewsRetrieve arguments passed via ARGV in the terminal
I have a make file. Inside this make file, I call this file that has it: set -f; echo $1 | bc I want to recover function value in C for that Makefile file. Example: ./a.out "12 + 12" result: 24…
-
2
votes1
answer1397
viewsHow do I correct "indefinite reference to 'function' in C?
Here is a simple example of TAD, which shows the error. file. h #include <stdio.h> #include <stdlib.h> int teste(); file. c #include "arquivo.h" int teste() { int a=5, b=10; return a+b;…
-
2
votes2
answers2674
viewsHandler? What is this and what is it for in C/C++?
For a long time I’ve seen many code using this type HANDLER. What is it and what is it for? Where I find tutorials that teach you how to use it.
-
2
votes2
answers198
viewsPointer changes the value within function in C++
I have the task of creating four functions that do multiplication, division, sum and subtraction between two numbers given by the user. The operation to be performed must be chosen through the * / -…
-
2
votes2
answers1067
views -
2
votes1
answer194
viewsDifference between Std::map, Std::unordered_map, Std::flat_map, and which one to choose?
What is the difference between library functions map, unordered_map, flat_map, and which one to use, for example in terms of performance?