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
-
0
votes1
answer442
viewsDraw between user-defined options
Hello, I am creating a Petri Net simulator (I considered it a challenge, since I am a beginner) and I would like to know if there is a way to create a draw between user-defined options. I would like…
-
0
votes1
answer815
viewsHow do I create a char variable with an indeterminate size
How do I create a char* variable (to store a name) with an indeterminate size? Example: char nome[30] = { 0 } // 30 é o valor máximo e no caso se a pessoa tiver um nome grande? que ultrapasse 30?…
-
0
votes0
answers123
viewsGet values from an audio file
I’m trying to use a c++ library to detect frequencies of a sound. To use it I need to pass a double type vector with the audio samples. I managed to get a vector but for that I had to use android…
-
0
votes1
answer106
viewsAttribute of a struct receiving multiple structs
It is possible an attribute of a struct receive several structs? For example, I need the attribute LPWFSPINFDK lppFDKs; that is part of the struct _wfs_pin_func_key_detail, receive multiple structs…
-
0
votes2
answers86
viewsTargeting failure in Mergesort
I tried to recreate the Mergesort algorithm in C++, but when compiling, the error "segmentation fault" appears. Here is the code below. What could I be doing wrong? #include <iostream> using…
-
0
votes1
answer171
viewsFunctions with parameters in c language
I need help to solve the following problem: "Write a function that receives an arrangement of whole as parameter and returns the index of the largest element of the arrangement. Ex : int intMax(int…
-
0
votes1
answer455
viewsConfiguring Visual Studio to use GTK+
I’ve been researching and the only place where I found something similar was in stackoverflow in English, where the configuration for use of GTK+ is described in Visual Studio 2010. From the little…
-
0
votes1
answer332
viewsDoubt how to take a JSON, turn it into an object
I have a little doubt about a json module in c++, I wanted to know if there is any way to take a json that already exists and increment more fields using c++, json data = json::parse(getData());…
-
0
votes2
answers1792
viewsHow to turn this C++ code into C?
#include <bits/stdc++.h> using namespace std; int main() { int n, i, n1, c = 0, c1, c2, max, pos, bar[501], arr[250001], j; cin >> n >> n1; max…
-
0
votes1
answer30
viewsIs it valid to convert an array to a class/struct?
Although I have tested I’m not sure if it will always work : class Val { public: int data[4]; }; int main() { int data[4]; Val* v = reinterpret_cast<Val *>(data); }…
c++asked 6 years, 11 months ago Rodrigo Santiago 1,822 -
0
votes1
answer68
viewsProblem executing methods of a generic class
I am developing a generic DAO class in Qt, but when I compile I get the following error, when I call any method of my DAO object: Debug\debug\main.o:-1: In function Z5qMainiPPc': undefined reference…
-
0
votes1
answer1569
viewsHow to pass string as parameter in C++
Whoa, guys, chill out? Next, programming teacher passed a little project and I need to pass a string as parameter in C++. How do I? I’ve seen it on the Internet and none of it worked. I tested it…
c++asked 7 years, 7 months ago Gabriel Azevedo 179 -
0
votes1
answer339
viewsRead and save information (C++)
Good afternoon. I am developing a project whose goal is to manage the drivers of a mobility company. Here’s what I’ve done... keep records of a new driver in the "driver.txt file". #include…
c++asked 7 years, 7 months ago Francisco N. 3 -
0
votes1
answer37
viewsCreate type using a structure class, and use the same type within the class
Currently I need to create a collection of classes that represent nodes (fragments) of the AST (abstract syntactic tree) of an interpreter. Now, for example, I gave an overview of the C++ templates…
-
0
votes0
answers105
viewsError using a c++ dll in a C#code
I created a dll with a code in C++, when I went to use gave an error. function within the dll that I tried to use extern "C" __declspec(dllexport) void ClickLeftMouse(int x, int y){ POINT cursorPos;…
-
0
votes1
answer83
viewsFunction NS_LOG - NS3(Network Simulator): What does the operator "<<" mean in practice?
I am working with the ns3 program, and trying to understand the code that I have at hand, I came across this line, and I would like to know what this sequence of "<" means. (I don’t mean the…
-
0
votes2
answers337
viewsdetect repeated char in c++ string
Hello, I’m trying to make a code to detect the occurrence of parentheses Na(CO5(Pt Let’s assume something like, I would have to detect the position of the two parentheses that are in the string. I…
-
0
votes1
answer32
viewsCompare to remove_if in c++ does not accept char
Hello, I’m trying to use a remove_if in c++ but when it gets to the input part I can’t determine for it to detect if the string I’m pointing has a char. Follows my code:…
-
0
votes1
answer116
viewsMeaning of this syntax
I need to continue a job that is partially ready. However I did not find on the internet files that described or taught this in an understandable way. What is the meaning of this syntax ? Ide:…
-
0
votes1
answer279
viewsWhile C++ does not enter the loop using string getline
Good afternoon guys, I’m having a problem with my code. When I ask if the user wants to repeat the program, it just doesn’t loop. I’ve tried using the user as numerical information and it worked,…
-
0
votes1
answer66
viewsFor syntax without the counter
I am a beginner in programming and I am studying the C++ language, therefore it is also my first time using this site. But after doing a basic course on the mentioned language, I downloaded a source…
-
0
votes1
answer115
viewsWhat is this operator **?
What is this operator **, and what is it for? Every time I come across a piece of code in C++ with this operator. And if it is related to *, what’s the difference?
-
0
votes1
answer136
viewsC++ Time Management System
I have to develop a time management system for the Data Structure chair in college, but I’m beating myself up to make it work. What is requested is the following: "Develop a time management system.…
c++asked 7 years, 6 months ago Luis Berger 3 -
0
votes1
answer338
viewsMultiplication of C++ matrices
I am making a program in C++ that allows the multiplication of 2 matrices, my problem is that I did not want to have to predefine the size of each matrix, so I used the following code: int ia, ib,…
c++asked 7 years, 6 months ago Diogo Martins 1 -
0
votes1
answer864
viewsmake a include of a library out of the library folder
How do I include a library that is not in my library folder in C++? I know the directive of #include with <> can do the include of the file that is not in the same folder, but if I own…
-
0
votes1
answer393
viewsDouble Chained List Removal Doubt (C/ Ordered Insertion)
In a C++ class the teacher had proposed an activity where I had to do a program in the format of a double-chained list with ordered insertion. However, I have a problem on the Removal part. By…
-
0
votes2
answers415
viewsProblem with ternary operator
I have a problem with the ternary operator. I want to use it to make the code more elegant because it is simple. But it’s as if it doesn’t work because it doesn’t update the variable. The following…
-
0
votes0
answers64
viewsCreate application to communicate with SYSFAN motherboard output
Hi, I’m in need of a library idea, language, code, that you know where I can write the code to communicate with the Fan output from the motherboard. To better understand the idea, there are…
-
0
votes0
answers120
viewsClose java(.jar) specific program with C++
I have a program running in java, I would like to close it if necessary with a monitor written in C++. As in taskmgr only java.exe appears, how to close the specific.jar program?
-
0
votes1
answer88
viewsI cannot make a vector point correctly to a function it belongs to
I have tried several times, but the compiler does not understand the references made in the header of the function void CalculaValorparaPagar(float ValorPago[MAX], float Quant_Kwh[MAX],float…
-
0
votes1
answer40
viewsGoogle test compare vector C++
I’m building a project and trying to use google test to compare the result of some functions. The problem is that my functions return double vectors and I can only compare double or whole in google…
-
0
votes2
answers868
viewsC++ Visual Studio
Hello, I’m very beginner in Visual Studio.I installed recently and I’m trying programs in c++ starting with simple programs but a same program that ran perfectly in Geany appears with several errors…
-
0
votes1
answer1397
viewsUser and password validation in C
I am making a game that requires authentication to play. How do I validate user and password saved in a file .txt? The code I’ve developed so far is this: void login(){ int escolhe_dificuldade(); //…
-
0
votes1
answer265
viewsWhy doesn’t g++ compile the code that visual studio compiles?
already makes some projects that I test and my g++ does not compile at all my projects of visual studio, errors that appear in g++ do not exist in visual studio... anyone knows why? and how do you…
-
0
votes1
answer74
viewsError running Hello World project with default eclipse CDT condigo
I’m trying to use the default code that comes in the Hello World project in Eclipse CDT(I’m using mingw), but when I put to run the project nothing appears in the console, only that the application…
-
0
votes1
answer326
viewsUsing methods from a project written in C++ in C# (Same Solution)
Hello, I need to consume methods written in C++ in a project written in C#, within . NET (both) and that are contained in the same Solution (as shown in the image below) I tried to compile the…
-
0
votes2
answers38
viewsC++ method assignment
#include <iostream> using namespace std; class Aluno{ public: string nome; int idade; float n1; float n2; float media(float n1, float n2); }; float Aluno::media(float n1, float n2){ return…
c++asked 7 years, 5 months ago igorarmelin 155 -
0
votes3
answers123
viewsproblem with inversion of values of a vector
Good evening, I can not find problem in a code of my, it is an exercise of the site codewars(https://www.codewars.com/kata/sorting-on-planet-twisted-3-7), for those who do not know the site,is a…
-
0
votes0
answers134
viewsHow to detect the collision with the SDL2 floor
I’m developing a game for learning using C++ with SDL2, and I want to check when my character touches the ground. For this I created the class "Collider", with the following function (adapted): bool…
-
0
votes2
answers2327
viewsObject vector in C++
How do I vector objects using c++? And how do I sort this array of objects, for example, using some sort algorithm (quicksort, mergesort, shellsort or radixsort)? #include <iostream> using…
-
0
votes2
answers261
viewsI connect to the database but the values do not change when I give UPDATE MYSQL Qt C++
The data is loaded in the table, then I change the data in the table, when I click on the update button, I can take the data (even the changes) and save it in the variable, but it seems that when I…
-
0
votes1
answer152
viewsVectors or Matrices in C/C++
follows below a problem can use vectors or matrices, I have a question on how to do item 1 of the menu, if anyone can explain me, I would appreciate it very much :) College X thought about adopting…
-
0
votes1
answer235
viewsCode problems from a C priority list
I am creating a priority list in C (topological ordering) using vectors and within these vectors a chained list pointing out who has to come before whom. It’s just that there’s a glitch in the…
-
0
votes1
answer123
viewsAllegro 5 C/C++: Color problem
I am using Allegro 5, and read that to create colors just use al_map_rgb or al_color_html, then I made a map to easily access various colors: #include "allegro5\allegro.h" #include…
-
0
votes1
answer89
viewsHow to perform in systems?
How the issue of performance in software, websites and etc works.? Facebook transpired PHP in C++ to gain performance. How does it work? I know with C++ to set exactly the variables, but the…
-
0
votes1
answer91
viewsHow do I get data from a file with fscanf, in c?
Code: while(fscanf(arq,"%d %d %d\n\r",x[i],y[i],raio[i])!=EOF){ cout<<x[i]<<endl; i++; } Contents of the file: mdb236rl D CALC B 912 2247 58 mdb240rl D CALC B 1752 776 95 mdb244rm D CIRC…
-
0
votes1
answer39
viewsCan I give new in one class within another’s builder?
I have two classes: Trajectory and Trajectory. When I go new to Trajetoi inside the constructor in Trajeto the program does not compile. Someone can help me? Builder of Trajetoi: Trajetoi(string…
c++asked 7 years, 5 months ago Sergio Souza Novak 513 -
0
votes0
answers28
viewsC++ Reduction of space spent
I’m creating a c++ project with Allegro 5 using code::Blocks, and I put the Allegro files right into the project folder to make it simpler. I’m only using functions to display images and text with…
-
0
votes2
answers2720
viewsHow can I measure the execution time of a program in c++?
I made a program that generates a vector randomly and then sorts it, using Bubble Sort, now I have to measure the time spent on sorting.
c++asked 6 years, 9 months ago Carlos Ferreira 39 -
0
votes0
answers168
viewsprintf(" n") changes the output of an integer
I am working on a recursive code that increases a variable every time I find a solution to my problem (I do not think it is relevant or necessary to explain the problem in question). Now, the output…
c++asked 6 years, 9 months ago Joaquim Carvalho 1