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
votes2
answers459
viewsSpecific libraries and standards of C compilers on Windows and Linux
I’d like to know why I know her. h and the strrev() library string.h, not on Linux. Is there any more that can only be done in Windows? And why does this happen? Is there any that can only be done…
-
1
votes1
answer74
viewsGetopenfilename() used with user personification
I have a process that requires SYSTEM privileges and for this purpose is launched by a service. When this process executes the function Getopenfilename() to open a select file dialog box, I get an…
-
1
votes1
answer1084
viewsPlace string in a character array
I am learning character matrix and wanted to make a simple program in which I create a character matrix 200x100, put a string at position 0 and printed. This is part of a larger program that I’m…
-
1
votes1
answer272
viewsHow to start an array with the value the user type is possible?
If all allocated memory is defined at the time of compilation, then how is this possible: int num{0}; cin >> num; int array[num]; From what I understand, this could only be possible if using…
array c++ memory-management allocation variable-declarationasked 6 years, 5 months ago silash35 483 -
1
votes2
answers387
viewsSave file data to a c++ map
I am not able to read a txt file correctly and transfer to a map in c++. The code I developed works only if you don’t have spaces " " in txt, if you loop and it doesn’t work. Here’s the code: void…
-
1
votes0
answers86
viewsError in libpq-fe library. h
I am using codeblocks and the library however I am with the following error: fatal error: libpq-fe.h: No such file or directory I have already added the path pointing to the header file by the…
-
1
votes1
answer306
viewsProblems with header in. h
I am using the code below to check the IP of the computer, but the Code Blocks is giving error. #include <ifaddrs.h> #include <ip.h> #include <stdio.h> int main() { struct ifaddrs…
-
1
votes1
answer322
viewsProblems making Arduino serial connection with PHP
I’m trying to make a thermometer with PHP, in Windows 10, and I’m capturing the data through an Arduino with code: #include <OneWire.h> #include <DallasTemperature.h> // Conectar o pino…
-
1
votes1
answer78
viewsDoubt in C++ program entry command
I am learning functions now in c++ and I went to try to run this program. It turns out that when I run it just doesn’t let me type in the value of cin>>p; it simply ignores the command and…
-
1
votes1
answer57
viewsInline in an infinite recursive function
What happens to the program if I declare an infinite recursive function inline?
-
1
votes1
answer52
viewsdecltype and pointers
I wanted to know why, when I use decltype(*Pointer) - using a pointer - it defines the type of the variable as reference, example: int i = 42, *p = &i; decltype(*p) c = i; What I want you to…
-
1
votes3
answers121
viewsHow can this be improved? (It’s just a little game)
I tried to make this game based on the Magic Cards. As I am still learning, that’s how I managed to do it. I would like to see other versions to know how I could have done and what I did of "wrong".…
-
1
votes2
answers55
viewsHow to find a comma inside a Textbox
I have a Text Box in which can only contain a comma, so I thought to make the program detect, when the user uses the comma, if there is already one in that particular Text Box. Here’s an example of…
-
1
votes1
answer89
viewsConversion to int with static_cast in c++
Doing a search found something related to this error. I have the following error below: ERROR: date.Cxx: In Member Function ːint Currentdatetime::Getmonth(const string&)': date.Cxx:125:18:…
-
1
votes3
answers141
viewsIsolate processor to run only my program
It has as I isolate the processor to run only my program in C? It’s more of a didactic and scholarly question that my I.A teacher passed on to me. He asked us to perform millions of operations to…
-
1
votes1
answer230
viewsDeclare MAP already passing values in C++ ?
Good guys, I see that with the array I can do this: int array[]= {5,6,4,2}; My doubt is, in the language C++ i can declare map already passing values ? Example: map<string,int> mymap = {…
c++asked 6 years, 3 months ago Victor OCV 393 -
1
votes1
answer77
viewsUtility of the coercion operator reinterpret_cast
What is the coercion operator for reinterpret_cast?
-
1
votes0
answers37
viewsSDL2 Does not draw pixels correctly
It’s been a while since I’ve been developing a CHIP8 emulator to learn a little bit of emulation, I’ve implemented all the instructions, except for the sound I’m going to implement, but I’m already…
-
1
votes2
answers99
viewsImage Processing? Doubt on the subject and usability
You guys talk all right ? I have a doubt if that’s the same name of the theme Image Processing I don’t know if you’ve ever looked there are some apps that carry a proposal like this. There is a…
-
1
votes0
answers30
views -
1
votes1
answer42
viewsHow to capture command line information
How do I, when typing a character, read the next one without the loop continuing until the iteration count is complete? Follow code below. #include <iostream> using namespace std; int main(){…
c++asked 7 years, 2 months ago Robson Lima 35 -
1
votes0
answers44
viewsPass vector start and end to Sort function using c++ method overload
I want to access using overload using node which is a base class object method getInicioVetor and getFimVetor within the daughter class, I wonder if there is a way to do this? I tried so only that…
-
1
votes1
answer78
viewsHow to concatenate values of different types into a string?
How do I concatenate all this string within a variable? Have some more elegant way to solve my problem? int num1 = 1; int num2 = 2; int num3 = 3; char simbol1 = '+'; char simbol2 = '-'; string…
-
1
votes1
answer133
viewsWhat is the difference of declaring a variable as constexpr const and constexpr?
What is the difference of declaring a constant as constexpr const for only one constexpr? constexpr const float max_height = 3.0f; constexpr float max_height = 3.0f;…
-
1
votes1
answer37
viewsWord split with find_if
How is this string(i, j) mounted? the first string inserted in the vector is "Robison" and is correct, but to have this result the value of i should be 0 and j = 7, no? #include <iostream>…
c++asked 7 years, 1 month ago Robison Aleixo 139 -
1
votes1
answer129
viewsError: expected class-name before
I’m developing a project where I have an online class that inherits from an X class, where this X class needs to give a new on an online class object. When I do this error happens due to inheritance…
-
1
votes2
answers61
viewsIs it possible to add extra classes to a dll?
The compiler can even compile perfectly , but for some reason when I run the app.exe gives me an error, follows my code: main.cpp #include <iostream> #include "cpp.h" int main() { ClassA * a =…
-
1
votes1
answer315
viewsHow to include header and cpp without resulting in LNK2005 error in Visual Studio
The source code below is an abstraction of a code in production. However, it is real, and the facts reported below are applicable to it. The code compiles usually in GCG (linux), but in Visual…
-
1
votes1
answer352
viewsHow to implement a copy constructor for a two-dimensional matrix in C++?
I have the following situation: a class Matriz implemented as follows: Header: #ifndef MATRIZ_H #define MATRIZ_H class Matriz { public: Matriz(unsigned int nL, unsigned int nC); ~Matriz();…
-
1
votes1
answer54
viewsrecursive function error in c++
This recursive function should calculate the multiplication of two integers but it is always returning +1 in the result, someone can help me? int multiplic(int m1, int m2){ if(m2==0){ return 1; }…
-
1
votes1
answer382
viewsSocket Operation on non-socket
I’m learning to program sockets but I’m having problems when it comes to exchanging messages between the client and the server, the two codes work as "should" only the problem is time to send a…
-
1
votes1
answer1170
viewsHow to create c++ processes?
I have a bit of mastery in C until the pointers part(I’m beginner), I have a college teacher who passed a question about processes,tried , but I don’t know how to solve: Question: Knowing that the…
-
1
votes1
answer68
viewsStruct with Union is giving invalid usage error
I need to use a union within a struct, but I’m not getting it. The error presented is [Error] invalid use of 'Union Client::document' Struct: struct Cliente{ string nome, email; union documento{…
-
1
votes1
answer69
viewsIs there a difference between "new" and "reinterpret_cast" for a memory buffer?
I wonder if there is any difference in the final product of these two codes : //------ Declaração curta class ClasseA { public: int valor; Classe() { iniciar(); } ClasseA * iniciar() { valor = 10;…
-
1
votes2
answers70
viewsUndefined Reference to `Teste_1::Teste_1
They usually say that . cpp is not included in the main but . h, but in my case whenever I include . h is an error and I don’t know why. follows the code: main.cpp #include <iostream> #include…
-
1
votes2
answers76
viewsC++, Program does not resolve all Instances!
Hey, good night, man. I’m in the first period of computer science, my university has its own website that evaluates its code and gives you a grade from 0 to 100, but it turns out that in this code…
c++asked 7 years, 1 month ago Victor Oliveira Silva 11 -
1
votes1
answer58
viewsC++ - Implementation of class Statica cpp
Hello! I was trying to implement a Static class but had the following error: "Undefined Reference to matematica::Cod" but the variable Cod is in . h follows the code below class . h and cpp; #ifndef…
-
1
votes4
answers106
viewsWhat’s wrong with my class function to diminish the value?
I’m developing a class to better manage my items in a more organized way. When the value of the variable is less than the minimum value was to go to the maximum value, however, in practice this is…
-
1
votes0
answers55
viewsProblem with my horizontal bar
I am having problems with my horizontal bar, the problem is that it is not increasing the value of the variable "Ivar" 1 in 1, is increasing 5 in 5 or even more dependent on how much I pass the…
-
1
votes1
answer47
viewsC++ - Is it right to create new types using?
Once in some post here on sopt I saw that create new types in C++ with typedef should be a practice to be abandoned as this is a C practice, and in C++ the correct one would be to use using…
c++asked 5 years, 11 months ago Samuel Ives 1,676 -
1
votes2
answers1339
viewsRemove first element from a simple chained list
I would like to do a function to remove the first element from a chained list, the way I did it is only removing the first node and removing the second element. struct lista { int info; struct…
-
1
votes0
answers18
viewsDisplay array during debug with android NDK
On android, when debugging my program I can see the vector and content of it: I have to pass this vector from android (java) to C++ and I’m using NDK. public native void testeVetor(double[]…
-
1
votes1
answer4040
viewsHow to show accented characters in Visual Studio 2017 using C++?
Good afternoon, I asked this question a while ago, but it was bad so I deleted it and I’m redoing it in more detail. My problem is this: When I accentuate in Visual Studio it returns strange…
-
1
votes1
answer111
views -
1
votes1
answer193
viewsWhy there are member initiators
In C++ we have the member initializers const. 1) Why such an appeal exists ? 2) How he acts under the cloths ?
-
1
votes2
answers371
viewsWhat’s the difference between initializing a variable in these constructs? And how do you set a constructor to default?
Is there a difference when initializing a variable in any of these constructor forms? And how do I default a constructor (default) in a class that has more than one constructor? Constructor 1: class…
-
1
votes0
answers33
viewsQcoreapplication::applicationVersion does not "recognize" RC_FILE when using Mingw
I created a file rc (Resource File) simple and added it to the project (winvertest.pro): rcexample.rc #include "winver.h" VS_VERSION_INFO VERSIONINFO FILEVERSION 1,0,0,1 PRODUCTVERSION 1,0,0,1…
-
1
votes1
answer55
viewsLoop a list of Getprivateprofilesection C++
I have a question, I’m a beginner. I wanted to list all the key names of an ini file, but only the name of the keys and loop from the first item to the last. char lista[255];…
c++asked 5 years, 8 months ago Pedro A. Pinheiro 15 -
1
votes1
answer162
viewsHow to modify dynamic matrix?
I’m having trouble modifying a dynamic matrix already created. The following example depicts my problem. In this example the program compiles but gives error of execution ( nothing appears and shows…
-
1
votes0
answers85
viewsHow to leave a function of an object superimposed on that of another object?
I’m having problems with my code for a D3D9 function, the "Create" function is always overlapped, need another function of the object (Draw) is overlapping the others. class cDrawItem { private:…