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
-
4
votes1
answer509
viewsPlay Sound (WINDOWS)
How do I play sound in a program developed in the C/C language++? Environment ()
-
4
votes2
answers1954
viewsQuestion about logical operators
I would like to know what the resolution of the following question is: In a paddock, there are several ducks and rabbits. Write a program that asks the user for total heads and total feet and…
c++asked 9 years, 6 months ago Domingos Gustavo 41 -
4
votes3
answers18584
viewsHow to use gets() in C++?
How to use gets() in the C++, when asked to type it and store it in a type variable char?
-
4
votes2
answers225
viewsSource code in Projects
If I have 10 projects in Netbeans, these 10 projects will use a log recording system, this system contains a log. h and a Log.c. Since all projects will have to use these two log files to generate…
-
4
votes1
answer341
viewsUnderstanding pointers
I’m trying to learn C++ on the Internet, I understand more or less what pointers are but I don’t see a utility, I don’t know anything about C++ I just don’t want to go over this subject, I did a…
-
4
votes1
answer689
viewsCall C++ from Lua
I wonder if there is a way to make a moon extension with a C++ blibioteca, ie the script moon access functions in C++. Ex: add.lua file -- add two numbers function add ( x, y ) CHAMAR AQUI uma…
-
4
votes1
answer199
viewsWhat is the reference of C++?
class Data { int d, m, a; public: void inic(int dd, int mm, int aa); void soma_ano(int n); void soma_mes(int n); void soma_dia(int n); }; void timewarp(Data& d) { } From what I understood the…
-
4
votes1
answer570
viewsFiltering data from acceleration and magnetic sensors on Android
I have a player open source for Android some time ago. Months ago I created an audio viewer (the type of ones with bars and colors) where the user could interact, simulating an augmented reality…
-
4
votes3
answers173
viewsWhy is it not (easily) possible to hide private members?
Implementation concealment is one of the keys to good modern software engineering, and crucial in code reuse. Why then, in c++ is it not possible to hide the private data implementation? Since these…
-
4
votes1
answer898
viewsHow do bit operators work?
I have the following code: volatile long Hex_To_int(long Hex , char bits) { long Hex_2_int; char byte; Hex_2_int = 0 ; for(byte = 0 ; byte < bits ; byte++) { if(Hex& (0x0001 << byte))…
-
4
votes1
answer150
viewsError "E2034 Cannot Convert 'Tbytedynarray *' to 'Tbytedynarray'"
I need to perform an integration with Horus System (Health), using C++ Builder. I already imported the .cpp of the Approval web service made available for my project. I have problems in the methods…
-
4
votes1
answer179
viewsIs it already possible to make commercial applications with Visual C++ Cross Platform?
Visual Studio 2015 brought with it Visual C++ Cross Platform, which I think works similarly to Xamarin. You can now make business apps with Visual C++ Cross Platform?
-
4
votes1
answer672
viewsDelete information from a vector that is in another C++ class
Hello, I have a question regarding classes in C++, I hope someone can help me. Thanks in advance! I am developing a work for college where I need to register students, disciplines and grades and at…
-
4
votes2
answers185
viewsHow to pass an array as argument with the user defining the column number?
I’ll make a simple program just to illustrate my problem. #include<iostream> using namespace std; void recebeValor( int mat[][col]) // me da erro de comp; { mat[0][0] = 2; cout <<…
-
4
votes1
answer3427
viewsStatement const at the end of function in C++ and const before argument in method
I came across this piece of code in a material: class Foo { public: int Bar(int arg1) const //<-- qual função do const aqui? { // código a ser implementado aqui } }; [1] Like the const affects…
-
4
votes1
answer2492
viewsRecursive functions in C++: examples
I am starting to learn C++ and I am currently focusing on recursive functions. I’ve seen some interesting examples, like the factorial calculation of a number, but I’d like to see other examples. I…
-
4
votes2
answers183
viewsNested Vector Logic - C++
I have a problem with the following statement: Given a vector A with n real numbers, obtain another vector B, also with n real numbers, as follows: B[1] = 2*A[1] B[2] = 3*A[1] + 2*A[2] B[3] = 4*A[1]…
-
4
votes1
answer94
viewsNested pointers and references
I’m having a doubt in the interpretation (the way I read my code) on pointer assignments in the C language. I did not understand the logic of the following assignments: "If i and j are whole…
-
4
votes2
answers1313
viewsC++ - Stop condition in repeat structure
How to put this code in a repeat structure so that after the calculation is shown the option "Type S to exit or C to continue"? #include <iostream> #include <string.h> #include…
-
4
votes2
answers7168
viewsHow to discover the version of my C/C++ on the Linux operating system?
I’d like to learn how to find the version of mine C/C++ in the operating system Linux. How could I do that through Terminal?
-
4
votes2
answers10606
viewsWays to instantiate an object and declare constructors
In C++ there are several ways to create a constructor and instantiate an object. But there are so many ways I’m confused by the difference of each. Assuming I have the following class: using…
-
4
votes2
answers658
viewsIn C++ what is the command corresponding to Java super()?
In Java: public class Teste extends Testando { private String nome; private int numero; public Teste(String teste, String nome, int numero) { super(teste); this.nome = nome; this.numero = numero; }…
-
4
votes1
answer264
viewsPerformance difference between static and shared library
Which is the best performance? Compile the program using libraries such as Mysql Connector and Sqlite as Static (staying inside the compiled binary) or as Shared being separated from binary. In…
-
4
votes1
answer1023
viewsWhy is the size of a struct not the sum of the sizes of its variables?
For example, the following code: #include <stdio.h> struct exemplo{ char letra; int numero; float flutuante; }; int main() { printf("Tamanho do char: %u\n", sizeof(char)); printf("Tamanho do…
-
4
votes1
answer200
viewsdoubt about exiber values and decrypt in the Chained Queue?
How to display the values in the correct row because it displays from last to first. #include <iostream> #include <cstdlib> using namespace std; struct Item { int dado; Item *prox; };…
-
4
votes2
answers1679
viewsHow do I generate random numbers and without repeating them in a time interval?
I am creating a 'game' in which it is necessary for the user to choose an interval, and in this interval, he chooses how many random numbers he wants to generate. However, in the random numbers…
-
4
votes2
answers1071
viewsGuess a number, and in attempts, by the percentage show hints
I am trying to create a game in which the user must determine an interval and guess a random number that is generated within this range. When the user inserts a number to guess, the program must…
-
4
votes1
answer124
views -
4
votes1
answer5292
viewsHow to make an HTTP GET request for a web service with Arduino
With a request via GET to a web service with Arduino, using the following URL and passing a parameter http://192.168. 0.1:8080/automation/Sensor? value=###, where ### is variable and is updated…
-
4
votes1
answer2062
viewsExponentiation operator in C++
About a question recently asked and answered: there is some reason - historical or not - why C++ (as well as many other programming languages) does not include an operator for exponentiation? For…
-
4
votes1
answer753
viewsHow to Classify a Triangle
I want to classify a triangle as to the sides, being that a triangle with all equal sides is designated Equilateral, with all different sides being designated Escaleno and if it has only two equal…
-
4
votes1
answer727
viewsCountdown time
I’m creating a mini-game with several questions and I want you to have time, x until zero. The counter only needs to have seconds and minutes. Does anyone know of any function in C++ or some…
-
4
votes1
answer506
viewsVariable without initializing
I did a basic function of squaring (exercise of a book), and I use a variable named aux and the use to calculate the power value squared, but the compiler claims that aux is not initialized, I would…
-
4
votes2
answers102
viewsSort method is not ordering correctly
I have the following code: #include <bits/stdc++.h> using namespace std; int main() { int n, cases = 1, a[3]; cin >> n; while(cases != n + 1) { cin >> a[0] >> a[1] >>…
-
4
votes1
answer1222
viewsScanf is not stopping on repeat
I have a loop while which will only end when 0 (zero) is entered. I have a variable which will receive a command option. Inside the loop I own a switch marry where: 0) exits the program (returns to…
-
4
votes2
answers178
viewsHow to define a method that receives a lamppost expression?
I have a class similar to this one and I wanted the code she executed to be passed as a blank expression. class T { public: double execute(); }; For example: T t; int a = 0, b = 1;…
-
4
votes1
answer1504
viewserror: initializer element is not Constant
I’m trying to declare this buffer overall and when compiling it presents the following error error: initializer element is not Constant char *ls_buffer_PPouAUT = malloc(5120*sizeof(char)); How can I…
-
4
votes1
answer571
viewsIs there a difference between C++ from GCC and C++ from Visual Studio?
I already programmed in C++ compiling with GCC and when I started using Visual Studio I noticed that it has support for C++, but the implementation is aimed at the platform . Net. There is a…
-
4
votes2
answers182
viewsExit multiple loops without using goto
Oops! The title says it all! Someone knows an interesting way to get out of more than one loop without using goto?
-
4
votes1
answer168
viewsHow to extend the length of Widgets within a Qscrollarea?
I’m looking to build a question form in Qt. As there are several questions to be answered, it is necessary to allow the scrolling of the form, and so I used a QScrollArea. Questions are all answered…
-
4
votes1
answer117
viewsCan I declare a library within a class in C++?
I need to use type variables string, the problem is that I cannot include libraries within my classes in Code::Blocks, there is some way to include the library string/string.h in my class in C++?…
-
4
votes3
answers451
viewsIs the Std::map structure in C++ a tree?
I know that every element of the structure is represented by a key and a datum, but I don’t see it as a tree, and I read somewhere that it’s a tree.
c++asked 8 years, 2 months ago Andrey França 2,313 -
4
votes1
answer125
viewsWhat happens on these lines in C++?
This is an Encoder reading routine that detects which direction of Encoder rotation. The references are left and right pins appreciated as MSB and LSB bits. The Code works perfectly, but I do not…
-
4
votes1
answer68
viewsProblems to remove vector node
I have two classes: class CAlbum { private: QString Nome; /**< Nome do Álbum */ QString Descricao; /**< Descrição do Álbum */ QString Diretoria; /**< Diretoria onde se encontra o Álbum */…
-
4
votes1
answer92
views -
4
votes2
answers607
viewsWhat is the difference between initializing a constructor or doing attribution within the constructor?
What is the difference between the two examples below? I should also assign the value within the constructor in this class even if I initialized? example 1: class sof{ int teste; public: sof(int t)…
-
4
votes1
answer1052
viewsParameters of the scanf function
When studying the function scanf with a little more depth I arose a doubt about the arguments I put before the % when reading a string, ie scanf("argumentos...%s",minhastring), in the following…
-
4
votes1
answer733
viewsLexical Analyzer using LEX
I am using the LEX generator to do a lexical analysis of a simple C++ code. The following code is from the generator: %{ #include<stdio.h> %} extern FILE *yyin; %% "<" {printf("(Identifier,…
-
4
votes1
answer90
viewsPass lambda expression on command line
I created a program to calculate the defined integral of a function, but I want to be able to run it through the terminal. #include <iostream> #include <functional> #include…
-
4
votes1
answer135
viewsWhy does a parameter have two "const" in its statement?
I’m reading the tutorials on the website of lib Opencv and during reading I saw the declaration of a function with a variable in a format I’ve never seen. I wanted to know what it means, declare the…