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
-
1
votes0
answers174
views"error: use of Deleted Function"
I’m having trouble compiling the example below, linux platform for esp8266, I need an example of how to return an object through a class function to another class. As an example: I need access to…
-
1
votes0
answers651
viewsHow to draw frames on the console, along with accented words?
I use the function BoxDraw below to draw frames, in a program with output in text mode (console). I cannot use this function if I use accent words, because when I include the library <locale>…
-
1
votes2
answers274
viewsPlaysound function
I am programming a game for school work in C++, and I have a game that during its execution starts a song, then when I click on the space key to fire the music stops and only hear the shot of the…
-
1
votes1
answer208
viewsProblems with dynamic allocation and struct
I intend to create a struct where there will be a vector of structs... The way I thought of doing it was kind of like this: typedef struct{ char *teste_str; int teste_int; }TESTE_A; typedef struct{…
-
1
votes1
answer393
viewsCopying strings in C
I would like a help on the following question: I have a char with a text of 32 characters, so I would like to know how to separate this char in two of 16 characters. Type: char textao[32] = "Oi meu…
-
1
votes1
answer58
viewsC++: Instances of the same class
I have in a project a class Collision, and to make detection more efficient, wanted to have access to all instances (objects) of that same class. Is there any easy way to do this? Edit 1 I did this:…
-
1
votes1
answer34
viewsComparison with ifs always entering the first
I’m trying to make comparison using if, but always goes on the first if: if((vetor[0] << vetor[1]) && (vetor [0] << vetor [2]) && (vetor [0] << vetor [3])){ cout…
c++asked 8 years ago Marco Sathler 11 -
1
votes2
answers56
viewsDeclare local classes as public
Hello, I have a problem that blow my head off: I’m making a script in C++ with the goal of making a game. Everything was fine when I ended up in a case that, so I researched, I did not find a…
c++asked 8 years ago Pedro Brito 65 -
1
votes2
answers1785
viewsCall cd command in c++ using system()
I’m trying to "program a shell" inside C++ but I’m not able to use the cd command (path) it just won’t go, searched and saw that when I use the system() a new shell is created outside the directory…
-
1
votes1
answer74
viewsCould you help me with Mergesort?
I’m having trouble compiling the Mergesort sorting method. #include <stdio.h> #define TAM 10 void intercalar(int vet[],int aux[],int ini1, int ini2,int fim2) { int…
-
1
votes2
answers163
viewsConverting a vector<struct> to C++ into C
I am trying to adapt a C++ function into pure C. I have changed the variable names and structs because it’s beside the point. typedef struct struct1 { int a; int b; int c; string d; } STRUCT1;…
-
1
votes1
answer133
viewsConvert assignments from C++ to C
I would like help to convert these made assignments into C++ to C: string binario = bitset<256>(address).to_string(); int InicioDado = 256-log2(cacheconfig.lineSize); string dado =…
-
1
votes1
answer223
viewsHow to install C++ compilers and previous version libraries in visual studio 2015?
How do I install older versions of c++ compilers and libraries in visual studio 2015 without having to install the IDE together? (i.e., only what is necessary to compile, run, and debug…
-
1
votes1
answer139
viewsExecute commands in a C++ string
I have commands in a string something like: string comm = "int x; cout << \"Digite um número\"; cin << x;"; My idea is to execute the commands that are in this string, having the result…
-
1
votes0
answers145
viewsWhat does that mean in c++?
I was taking a look at how to use templates in c++, when I came across this here return (a>b?a:b);. ( http://www.cplusplus.com/doc/oldtutorial/templates/ ) What is this ? code? I tried to google…
c++asked 7 years, 4 months ago Navi Seven 11 -
1
votes2
answers57
views -
1
votes1
answer141
viewsMenu with Polymorphism
I’m creating some examples to learn polymorphism more deeply, but in the original code, all functions work correctly. Original code: #include <cstdlib> #include <iostream> class Mamifero…
-
1
votes1
answer248
viewsWhat is the reason why a vector with no set size does not work?
If you create a vector: Thus int Vetor[0]; works #include <iostream> using namespace std; int main() { int vetor [1]; vetor[0] = 12; cout << vetor[0] << endl; } Thus int Vetor[];…
-
1
votes2
answers258
viewsRemove stopwords listed in a txt file from another txt file
Good evening guys, I need help. I am doing pre-word processing and for that I need to remove from a book in format . txt all stopwords found in a text file also "stopwords_br.txt". I found a program…
-
1
votes0
answers168
viewsFastcgi with C++ and NGINX
I am trying to make a small server for study using fastCGI with C++ without using any library. My problem is that via socket NGINX even connects but does not give me any information about the…
-
1
votes2
answers1485
viewsProblems with function that returns character array in C++
Follows the code: #include <iostream> char* criaVetor(){ char vetor[20]="Olá mundo!"; return vetor; } int main(){ char retorno[20]=criaVetor; std::cout << retorno; return 0; } error:…
-
1
votes2
answers494
viewsHow to calculate the Xmin,Xmax,Ymin,Ymax of an object?
I’m playing a simple game like "space Invaders" in Opengl and in the part of the collisions need to calculate the minimum and maximum X and Y values, but I still can’t figure out how to do this.…
-
1
votes1
answer148
viewsInsert character by character of the Russian alphabet into a char vector in C++
Hello I would like to know how to insert characters (of the manual form) of the Russian alphabet in a char vector, because I am trying the form below and the problems in the press. Follows the code:…
-
1
votes0
answers100
viewsHow to call a function from an already injected dll(c++)?
how do I call a function within a DLL already injected into the process? example: I would like when I press a button on the form I created, to call the asmFunction() function; if I call the function…
-
1
votes1
answer2948
viewsSplit numbers of an int. C++
Hello! I am reading and studying about C++ in the book " C++ How to Program 5th edition ". There is a question in pg 97. Question 2.28 which I cannot accomplish, being it: Write a program that…
c++asked 7 years, 10 months ago user61092 -
1
votes1
answer616
viewsWhat is the difference between Getkeystate() and Getasynckeystate()?
I’ve always used the GetKeyState() to know if the user is pressing a key, but I see that many people use more the GetAsyncKeyState(). With that came to me the following doubts: What is the…
-
1
votes1
answer253
viewsExport methods from a dll in C++
I’m having a problem, my dll has not exported the methods for me to use in other programs. I did it this way: namespace integration { class RESTRequest { public: __declspec(dllexport) string…
-
1
votes1
answer663
viewsCan you capture events like this when pressing a C++ key? [Codeblocks]
Good morning, I am making an Autoclick bot for personal use and I would like to add the function of pausing clicks when pressing a specific key but I do not know if it is possible to do this in…
-
1
votes1
answer61
viewsWhen I am instating a class I need to perform a 'delete' after using the object even if the class has a destructor?
If I instate a class and Gero an object from it obligatorily I have to displace the memory of that object at the end of its use, right? But if the class that originated my object has a destructor it…
-
1
votes1
answer45
viewsStruct presenting problem
I am unable to compile the program shows error in variable declaration struct product, when I try to create an instance in the main. #include <iostream> using namespace std; struct produto;…
-
1
votes1
answer975
viewsHow to identify whether the area of an object is within another area desired by the user, drawn by the mouse
Hello! I recently started to venture into the Opencv library in C++. Today, I want to develop a program that applies a classifier to a polygonal ROI (5 points), obtained through 5 clicks with the…
-
1
votes1
answer49
viewsChar* value is shown even where it was not called using Arduino
This is exactly what I’m wearing: #include <SPI.h> #include <Ethernet.h> byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; // Tentativa frustada, possui o mesmo problema: //uint32_t…
-
1
votes1
answer142
viewsWhat is the function mysql_store_result() for?
Hello, I’d like to know the real function of the mysql_store_result() method within the C++ language when we are working with mysql database.
-
1
votes1
answer108
viewsUndefined Reference to 'dlopen'
I’m trying to upload a file .so, but this title error is showing up. Can anyone help me? #include <iostream> #include <dlfcn.h> #include <stdio.h> using namespace std; int main() {…
-
1
votes0
answers28
viewsThe menu does not appear in the wxWidgets frame
I have a small application wxWidigtes in C++, where I have a frame that has a status bar and menu bar. However, the Manu bar is not displayed in the frame. What to do? #include "MenuMain.h" #include…
-
1
votes1
answer115
viewsBuild error: expected ';' before 'case'
I’m trying to compile this program here in Code::Blocks but I’m not getting it and I don’t understand why. #include <iostream> #include <string> #include <stdlib.h> #include…
-
1
votes3
answers211
viewsHow to take data from an object and do mathematical operation with another object in C++?
I have to calculate the distance between two points in C++ (Object Oriented) Here’s the code I got: Ponto p1(2,-3); Ponto p2(4,5); class Ponto { public: Ponto(int x1, int y1) : x(x1), y(y1) {}…
c++asked 7 years, 1 month ago Thais Mayara 77 -
1
votes0
answers159
viewsSocket between C++ and C#
I’m facing a problem. I have the server code done in C++, running in Ubuntu. And I have the client code done in C#, running in windows. In the server code (C++) I came across a problem //recebe…
-
1
votes1
answer388
viewsUse of Thread in c++
I created a code to check the prime numbers, but I’m trying to use the core of my processor to calculate them. #include <iostream> #include <Windows.h> #include <vector> #include…
-
1
votes1
answer251
viewsHow to reference instance variable with the same name as a local variable in C++?
In C++, how can I reference an instance variable that has the same name as a global variable? For example, in a set method of the following class: class Person { private: string name; public: void…
-
1
votes1
answer72
viewsHelp with regular expression
Hi, I need a hand with Regex. I need to split a string to store in a list, so I’m doing like this. QString a = "strength 0.5"; QString b = "'kernels[1].params.sigma_albedo' 0.02"; QString c =…
-
1
votes0
answers569
viewsWhy use gets and sets in classes?
What is the reason and when to actually use gets and sets instead of a publish variable in classes? They say it is a bad practice to use and modify a variable as public, why? Example 1: class Teste…
-
1
votes1
answer1518
viewsList (static) operations c++
Good afternoon guys, I’m having a hard time understanding the operations in Statist lists, I know create and display, but how do I remove and search within the list, the sorting algorithms I’ve…
-
1
votes0
answers49
viewsBuild error on this line of code
I have an algorithm here that is showing compilation error on this line #include "filadvet.hpp". I’m not gonna show you all the code because the algorithm is big and there’s no need. The rest of the…
-
1
votes2
answers451
viewsSemantic difference of "Malloc" and Calloc"
I was in programming class with C and I got the doubt about the difference between Malloc and Calloc, but not in what each one does, but in the meaning of "M" and "C". I know that Malloc comes from…
-
1
votes1
answer101
viewsWhat is the point of calling conventions and which one to use?
What is the purpose of calling conventions __fastcall, __stdcall, __thiscall, __cdecl, __fastcall and how to know which one to use? For example, in some function that needs to be called faster (I…
-
1
votes1
answer62
viewsError in the average calculation of a student record
printf("Nota 1: "); scanf("%.1f", &alu[n].not1); printf("Nota 2: "); scanf("%.1f", &alu[n].not2); alu[n].media = (alu[n].not1+alu[n].not2)/2; // o erro acontece NESSA LINHA invalid operands…
-
1
votes0
answers51
viewsAlways On Top Style SFML Application
I play an FPS game with the sniper class, but the sniper does not appear as the other weapons, which hinders me when targeting the enemy. I made a program that draws a sight on the screen. It is…
-
1
votes0
answers26
viewsWhy does this parser fail in Boost Spirit C++?
When I enter the input tt or tt the program returns me "parse failed". However, to me the grammar seems correct, so I believe it is some peculiarity of the library. Would anyone like to explain the…
-
1
votes1
answer93
viewsWhy use a pointer to that algorithm?
When I withdraw the code does not work. Why? And why the algorithm of Insertion Sort is only suitable for list of small entries, type array and list (little)? void insert_sort(int *vetor, int TAM){…