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
-
3
votes1
answer145
viewsHow can Qdialog lock a Qmainwindow?
I am implementing an experimental registration program, and I made a case where, if a person types nothing and tries to register this empty data, it opens a QDialog, receives the warning and does…
-
3
votes1
answer199
viewsError in transforming parametric equation. Opengl and glut. h
My question is this:: Let the parametric equations given below define a curve as a function of t R: x(t) = sin(t) + 1/2(half a) sin(5t) + 1/4(a quarter) cos(2,3t) y(t) = cos(t) + 1/2(half a) cos(5t)…
-
3
votes1
answer66
viewsQcustomplot how to resize graph?
I’m trying to do a repeat histogram of 255 events, I don’t know what is the maximum amount of times this event can occur! I have a array of 255 elements, already with the amount of repetitions of…
-
3
votes1
answer127
viewsRepeat commands to restrict a valid value
I need a code that reads a number greater than 1, and if a number less than or equal to zero is entered, another number is requested, and therefore can be tested if true. I wanted help to complete…
-
3
votes1
answer192
viewsQt5 Deploy on Linux - No installation
I’m developing a solution in Qtcreator Qt version 5.4.2. Well, I have the following problem: When I run on my machine and on any Ubuntu Vivid (15.04) it works. But when I try to run on Ubuntu 14.04…
-
3
votes2
answers128
viewsUse of conditions in matrices
I need to do a program that reads a 4X4 matrix and then sums the values in each row and then for each column. I’m not sure how to define my condition. #include <stdio.h> int main() { int…
-
3
votes1
answer1597
viewsKruskal’s algorithm problem C++
I’m implementing Kruskal’s algorithm, only I’m having a problem because he’s missing one of the links and the value of it, I’ve already made an implementation in Dijkstra, only in the work I’m doing…
-
3
votes2
answers2523
viewsRemoving blanks from a string
I want to remove all blank spaces from one string, but I don’t know how to do I’ve tried to use replace but it didn’t work out.
-
3
votes1
answer201
viewsHow to use string in C++?
I’m having trouble dealing with string. #include <stdio.h> #include <conio.h> #include <stdlib.h> #include <iostream> using namespace std; bool ArqExiste(string Arquivo) {…
-
3
votes1
answer79
viewsUndefined Reference to Symbol when compiling program in C++
I’m testing the curlPP library and wrote the following program: #include <iostream> #include <curlpp/cURLpp.hpp> #include <curlpp/Easy.hpp> #include <curlpp/Options.hpp>…
-
3
votes1
answer433
viewsI’m wanting to display the amount of negative numbers typed using functions
#include <iostream> #include <locale.h> using namespace std; int getnegativo(int a, int b); int main() { setlocale(LC_ALL, "portuguese"); int…
-
3
votes1
answer112
viewsHow to read a variable in setText()?
I need the text of a lineEdit is equal to a variable string. I’m using this code: void MainWindow::on_pushButton_clicked(){ string texto; texto= "mensagem"; ui->lineEdit->setText(texto); }…
-
3
votes1
answer3056
viewsImage editing using Opencv with no ready-made functions
I have the following picture shown below and I need to turn it into gray and then binarize it. I use the following code to show it on the screen cv::Mat img = cv::imread("lena.jpg");// Lê a imagem…
-
3
votes1
answer115
viewsVector calculus C++
I need to implement some vector and matrix operations, such as internal product, vector, other operations with matrices (inverse, transposed, conjugated, determinant, etc.) and to solve certain…
-
3
votes2
answers597
views -
3
votes2
answers107
viewsHow to fix multiple errors in this code?
I’m making a code that needs to contain 3 vectors (number one. enrollment, grade 1 and grade 2), relative to 6 students, which needs to be included: the final grade of each student; class average; o…
-
3
votes2
answers65
viewsIncremental result?
I have a doubt about this expression: y-=++x I can divide this expression in two? x= x+1 and then?
-
3
votes1
answer562
viewsClass implementation in the header itself
In my object orientation studies, I have seen many say that in creating classes it is necessary to create a header, containing class, attributes and methods, and also another file cpp to implement…
-
3
votes1
answer2388
viewsAccess attributes of an object vector of another class using C++ pointers
I am doing a job for the college in which I have to put together a program to manage a restaurant that only makes deliveries the orders are made by phone and internet using object orientation and…
-
3
votes3
answers8393
viewsZeroing position of a vector to ensure there is no dirt
How do I reset the position of an integer type vector, for example, to ensure that there is no "dirt" when allocating the position in memory in C++? Some language function or an algorithm.…
-
3
votes1
answer1858
viewsIn C/C++, what are the build directives for? When should I use them?
I came across a C code that used a compilation directive on #ifdef and I didn’t really understand what it was for. I found an explanation, but it wasn’t clear. Here is an example of a directive and…
-
3
votes1
answer4507
views"error: 'string' does not name a type" when declaring strings
Follows the code class Nome { public: Nome(string nome, string sobreNome); void exibirNome(); virtual ~Nome(); protected: private: string nome; string sobreNome; }; Error error: expected ')' before…
-
3
votes2
answers439
viewsWhy Delphi/pascal builders cannot be private like in C++
Is there any reason why I can’t leave a Delphi constructor as private?
-
3
votes1
answer1532
viewsHow do I get the mouse position (x and y) on the console? C++
I have the following code: #include<windows.h> #include<iostream> #include <cmath> using namespace std; int main() { HWND myconsole = GetConsoleWindow(); HDC mydc =…
-
3
votes1
answer559
viewsI’m having trouble displaying the names of people over 18
/*Escreva um programa que receba o nome, profissão e a idade de 10 pessoas, calcule e imprima a quantidade de pessoas maiores de idade (idade >= 18 anos) e seus respectivos…
-
3
votes1
answer294
viewsHow to include the same class in multiple files?
Because I can’t include the same class in multiple type files like this: #include "familia.h" class pessoa{ private: familia *f; }; ----- #include "pessoa." class familia{ private: pessoa *p; };…
-
3
votes1
answer155
viewsPort Visual Code C++ to another language
Next, I have a simple Shellexecute code that was done in Visual C++ 2012, but because it is a closed and paid platform and because I need my customers to keep downloading more programs I would like…
-
3
votes4
answers3023
viewsRand between numbers with comma
How to generate a number float between two numbers? Ex.: A random number between -270.33 and -47.5.
-
3
votes1
answer139
viewsIs there a problem with pointers in this struct that works with chained lists?
Hello. I’m developing a game with C++ language and I think I’m making a mistake in using chained lists. I think I know that there are more interesting features than using chained lists in C++, but…
-
3
votes1
answer94
viewsPointer cannot be reset to NULL within function
Hello, folks! I was studying binary trees and needed to create a function that would remove any knot and its children. However, when I did this function with the return /1/ the node has not been…
-
3
votes1
answer1906
views -
3
votes2
answers481
viewsDoubt of C++ loop do-while
Good people, I have the following question: Every time I run that program the do-while loop doesn’t stop at the second loop scanf in the program and ends up running twice and displaying the error…
-
3
votes4
answers934
viewsHow can I decrease program processing time?
I need to show this exit: 1 2 3 PMU 5 6 7 PMU 9 10 11 PMU 13 14 15 PMU 17 18 19 PMU 21 22 23 PMU 25 26 27 PMU #include<stdio.h> #include<stdlib.h> #include<math.h>…
-
3
votes1
answer102
viewsBinary Search Tree - Printinorder();
My BST (templated class) has function PrintInOrder(), that does not receive parameters: void BST<Type>::printInOrder() const{} I’ve been looking on the Internet, and I found some InOrder(),…
-
3
votes1
answer400
viewsHow to convert Ansistring to Char in C++ Builder?
I need to pick a file txt through the OpenDialog, to open through fopen. The problem I’m found is in the conversion. The function fopen has as a parameter a const char, already opendialog returns…
-
3
votes3
answers1104
viewsChange of vector size in a structure
I have the following structure: struct Implicantes{ int posicao; char binario[5]; bool dontcare; bool tick; struct Implicantes *Next; }; It is possible to change the vector size of char "binary" of…
-
3
votes1
answer59
viewsHow to get version of my application?
I need a way to get the version of my app on C++ Builder, to put in the Caption of a TLabel, which will be displayed next to a system presentation home screen.…
-
3
votes1
answer833
viewsOptimization game Bulls and Cows
I made this code from a game called Bulls and Cows (bulls and cows) where it’s a guessing game, but it’s a little different, I’ll give you an example: Hidden numbers are 1 2 3 4. If you put 1 2 6 7,…
-
3
votes1
answer9873
viewsHow to create a class with attributes and methods in C++?
In Java I know how to do it, but in C/C++ it’s little different so how to create a class with attributes and C methods++? I am using Codeblocks. When I create a class in C++ it creates two files one…
-
3
votes1
answer77
viewsAlgorithm Turning Off PC Screen after Run
I am using windows. h in conjunction with C++, for the purpose of creating a routine through INPUT events. Such as setting the mouse position on the screen, clicking and things like that, but every…
-
3
votes1
answer48
viewsUnderstanding the concept of export Symbols in shared libraries
I’m reading about this concept of exporting elements out of a shared library (DLL or OS). I’m reading that one existing publication on the GCC Wiki. The last example of the publication is this: //…
-
3
votes1
answer272
viewsSegmentation failure during image to grayscale conversion
I am writing code that should receive a color image file (PPM format) and turn it into grayscale (PGM format in ASC II code) After having done functions to read, convert the colors and save the…
-
3
votes4
answers8575
viewsHow to take system time and save in a variable?
How to pick the current time and save to a variable in c++?
-
3
votes1
answer266
viewsSublime Text 3 - Headers autocomplete in the directory
After the failure to search for a plugin in sublime text 3, I come to ask for help. I need to recognize the libs installed on the system, for this I look for a plugin capable of providing an…
-
3
votes1
answer43
viewsRandomize images as textures in 3D solids
Good, I have 30 solids and I have a different image for each of them. I created one array for the images, and if you choose to use the same image at all (as I left here in the code, use the bandeira…
-
3
votes1
answer284
viewsHow to get the time in seconds of a date in string format?
I know the function time(0) me returns the seconds since the first of January 1970, in case the user would enter a date (dd-mm-yyyy or in any format due to system limitation) and the system would…
-
3
votes2
answers80
viewsParameters for external call
I use Linux and by default (or at least in my case) it does not have screen brightness control, but has a program that gives to control. The point here is that I want to take the "user" value and…
-
3
votes1
answer227
viewsBug when using Cin detro command of a loop
When I run this code it Buga, i type 1 and it enters the registration function but not pause to read the data (keeps printing things non-stop)when I change the cin for scanf it works). You can make…
-
3
votes1
answer658
viewsCan C++ and C# be used using C programming?
If I build a code for a sotfware and want to use the C, C++ and C# languages could I? Even if I use a compiler that reads all three?
-
3
votes1
answer264
viewsI need to register several products
I am creating a Product registration code, but I can only store a single product. How to improve the code? #include<iostream> using namespace std; void novoProduto(){ string nome="Patrick…