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
votes0
answers108
viewsBacktracking to sudokus without solution
My algorithm can solve sudokus with solution (not optimized) but when sudoku has no solution the algorithm does not reach the stopping condition. Sudoku.hpp #ifndef _SUDOKU_H_ #define _SUDOKU_H_…
-
0
votes0
answers228
viewsProblem with C/C++ sorting methods (Radix Sort)
I’m having trouble with this code... when I run it it’s returning me to negative run time. He was supposed to show me the execution time of each method. And not being able to change the function…
-
0
votes1
answer108
viewshow to pass char from the main int to a class c++?
I’m struggling with how to pass a char type variable from the int main and play to a variable in the class. Example of the way I’m trying: class Nome{ private: char n[50]; public: void set_nome();…
-
0
votes2
answers99
viewsdoubt string/map c++
Good afternoon! I’m answering a programming list, the question is very easy and I know the logic of execution but there is a part that I do not know how to implement, I left it in italic. Make a…
-
0
votes1
answer58
viewsConversion Farenheit Celsius
Make an algorithm that calculates and writes a table of centigrade against degrees Farenheit, ranging from 50 to 150 of 1 in 1 I found the solution in C not in C++, #include <iostream> using…
c++asked 5 years, 6 months ago cristovanlopes 5 -
0
votes1
answer167
viewsVariable and scope beyond file . cpp C++
Is there a possibility of a file . cpp "seeing" a variable declared in in another file . cpp? Example: in the main.cpp file there is a global variable int myVar. You can access it in another file,…
-
0
votes2
answers466
viewsIs it wrong to mix struct with class in C++?
I have the following class: #ifndef PESSOA_H_INCLUDED #define PESSOA_H_INCLUDED #include <string> struct aniver{ int dia; int mes; int ano; }; class Pessoa{ private: std::string nome;…
-
0
votes0
answers83
viewsThe wrong date Julian calendar
I made the following program based on one of my scripts that makes other calculations but the same is returning wrong dates to the Julian calendar, because 14/March/1964 falls on Friday, and…
-
0
votes1
answer83
viewscomposition and validation
Guys I have a struct called Contact with variables Std::string and a ready-to-use email validation class using regex. I am creating a program and not need to create another validation function for…
-
0
votes1
answer47
viewsVariable not receiving value
I have a program, where when I click a button the program pauses, and when I click again it continues, but I realized that in that period of time when I pause the program, the variable that I want…
-
0
votes0
answers21
viewsFailed to create a dll with constructors in the classes
I created a header with dll settings: globaldef. h #pragma once #ifdef OPENXML_LIB #define OPENXML __declspec(dllexport) #else #define OPENXML __declspec(dllimport) #endif // OPENXML_LIB I have…
-
0
votes2
answers148
viewsfunction using char and vector in c
Good evening, I’m facing a problem. I’m trying to fill a vector in C that way. int a[5]; void lerValor(char grupo, int posicao, int valor) { grupo[posicao] = valor; printf("%i", grupo[posicao]); }…
-
0
votes1
answer89
viewsOpengl Unbind Texture?
I have a list of objects; Each object has different amounts of texture; When I do glBindTexture 2 textures (fuzzy and specular) to an object, it can happen that the next object can have only 1…
-
0
votes1
answer129
viewsObject created within conditional If generates c++ build error
I’m having trouble compiling a C++ program in IDE Code::Blocks. What I’m trying to do is access an object that was instantiated within an If parole. I will put down the codes of the main program and…
-
0
votes3
answers4086
viewsWarning: control Reaches end of non-void Function - c++
I’m doing a function to return the maximum and I’m having problems... #include <iostream> #include <cstdio> using namespace std; int max_of_four(int a, int b, int c, int d){ if(a >…
-
0
votes1
answer191
viewsExercise URI 1012 - Wrong Answer 20%
I did the exercise, almost all outputs are coming out as URI output is asking, but the first requirement is not as requested in the program. I used setprecision, but I am in doubt why the first…
c++asked 6 years, 10 months ago Vinicius1402 29 -
0
votes1
answer28
viewsHow to check the state of a Gtk::Radiomenuitem object?
I am building a dynamic menu using Gtkmm. The menu is built as follows: Gtk::RadioButtonGroup appRadioGroup; bool groupInitialized = false; Gtk::Menu *driverSubMenu = Gtk::manage(new Gtk::Menu);…
-
0
votes2
answers100
viewsI can’t edit cloned git files on the PC
I have to do a job and put it in git with a friend, he already gave permission for my account to be a contributor. I cloned the project on my PC so I could program my share and send it to github…
-
0
votes0
answers172
viewsRead and write binary file in iteration
I’m doing a college job that requires us to create a system that records multiple read structures of the standard output into a binary file, leading to the need(?) for iteration usage. Unlike the…
-
0
votes1
answer912
viewsSegmentation fault (core dumped) when accessing String
I built the code below to separate only the last characters of a link (the last 11 to be exact). Until then everything works well, calculations are done normally, values also match. The problem is…
-
0
votes1
answer47
viewsUnconfigured output on Atom
I use Atom + gpp Compiler to study c++ in windows. When I use accents the output is all messy. Is there any way to allow the release of accents? Thanks for the help…
-
0
votes1
answer302
viewsCall a function based on the struct passed in the reference?
How Do I call the menu function by passing more than one struct per reference according to the validation in the validation function ? sorry I’m starting now and decided to do this little exercise…
-
0
votes1
answer70
viewsGraphs with noise in the Adian in the plotter
Implement code that simulates the speed of a car as more noise signal, with 50 elements. The speed value increases linear mode by 0-50 km/h. The noise amplitude is 1 km/h. Values are sent to the…
-
0
votes1
answer637
viewsDestamping Dynamic Stack
I have a dynamic stack algorithm. Only if I insert 10 elements into the stack and pop without removing the first element it from the segmentation failure. And if I remove the first element from the…
-
0
votes0
answers13
viewsWhat does two asterisks mean before the name in C++?
char **argv What these two asterisks mean?
c++asked 5 years, 2 months ago WhitteFace 1 -
0
votes1
answer105
viewsJoining of vectors in C
I have a doubt in this code because the function should print {1,2,3} but I printed {1,2,3,4,10,24,73} void uniao(int A[], int B[], int C[]){ int i; for(i = 0; i < TAMANHO ; i++){ if (A[i] == 1){…
-
0
votes3
answers379
viewsHow to insert a ";" at the end of the string, program in c
I wonder what I should do for the ";" in the print appear afterward of string and not before. I’m new to programming and I’d like to appeal to your help. Thank you Input Linha1 Linha2 Linha3 Linha4…
-
0
votes0
answers227
viewsIndefinite reference error - Allegro 5
I installed the lib Allegro 5 with the following script : cd ~/Documentos sudo apt install -y git build-essential subversion cmake xorg-dev libgl1-mesa-dev libglu-dev install libpng-dev libz-dev…
-
0
votes1
answer63
viewsFails when accessing a vector option that does not exist
I made a few years ago an algorithm of inheritance and polymorphism it is working correctly but if I type 7 that is a non-existent option in the menu it returns segmentation failure instead of…
-
0
votes1
answer91
viewsRead ESC key at runtime
I’m writing a program that reads an indefinite number of keyboard values and stops only when the user presses Esc. I tried to solve this using the function GetAsyncKeyState() as follows. #include…
-
0
votes2
answers80
viewsProblem with neighboring positions in C++ arrays
#include <iostream> using namespace std; int main(){ int myVector[] = {2,6,4,1,9,5,7,3,8,0}; int tamanhoVetor = sizeof(myVector)/sizeof(myVector[0]); //Imprime for (int i=0;…
-
0
votes1
answer83
viewsStack insertion vector returning all zero
These days I posted the algorithm of this address below here because I was having problems to pop and remove was solved so far. Destamping Dynamic Stack But as I was reviewing the code and therefore…
-
0
votes1
answer526
viewsChange an attribute of a base class by the derived class C++
I’m having a problem involving inheritance in C++, I can’t change an attribute of a base class ex: // classe base class Base { vector(string) Names; //coloquei entre parenteses porque por algum…
-
0
votes1
answer114
viewsOpen Visual C++ with arguments to compile
I am starting with the visual C++ and I have a project where it is necessary the visual c++ to compile the program automatically. so I thought of arguments like we can use in normal prompt like: cmd…
-
0
votes1
answer305
viewsRead string with c++ spaces
I need to read a string considering the spaces in c++. Type like this: string frase; std::cin >> frase; It seems trite, but I can’t seem to solve it. Grateful, from now on.…
c++asked 5 years ago user168685 -
0
votes1
answer291
viewsI can’t get into "EOF"
I’m trying to solve the following URI problem the problem is time to make the EOF happen, I understand more or less how it works but still can not make my program "stop". int main(){ string entrada;…
-
0
votes2
answers130
viewsSuggestions for code improvement
Good evening, I created a C++ Hangman as an exercise and would like to receive suggestions for code improvement. Thank you from the outset for those who can answer. Follows the code: #include…
-
0
votes0
answers135
viewsI cannot compile c++ or c code in any ide
For a while I’ve only been able to compile c or c++ code in my cmd. And I can’t compile in any ide. Whenever I try to compile the error appears:…
-
0
votes1
answer235
viewsWhy is it impossible to use Opengl in Qt 5?
Probably, Opengl is the only thing I can’t use in Qt, maya and 3ds and other Autodesk programs use opengl in Qt, but no tutorial or example that works. I already created a class for the widget based…
-
0
votes1
answer122
viewsOpencv c ++ how to display a text (letter) on the webcam in c++?
I’m using, open source, sorry, I’m beginner, I want to change it on if and else: else if (!thumbIsOpen && !firstFingerIsOpen && !secondFingerIsOpen && !thirdFingerIsOpen…
-
0
votes1
answer44
viewsProgram Crashing at random
I am working with C++ Lists and while doing the following list implementation code: #include <iostream> using namespace std; class NO{ int idade; string nome; NO *no; public: void…
-
0
votes1
answer1138
viewsC++ code error with getline(Cin,string)
I’m learning to program in C++ and when I use the getline function(Cin,name) I can’t put text in there and the Avanca code for the next line. The program should ask for age and name and is supposed…
-
0
votes1
answer37
viewsProblems with arithmetic operators in C++
I’m trying to get the program to calculate the discount value of a certain value entered by the user; #include <iostream> #include <stdio.h> #include <locale.h> using namespace…
c++asked 4 years, 8 months ago glaubermlira 53 -
0
votes1
answer160
viewsNegative, positive and zero numbers do not return as expected
The code is ignoring the type variable int and is receiving real values. Also, when I enter a character it returns that is zero and not that it is not a valid number. Identify whether it is…
-
0
votes1
answer54
viewsError in variable type
What fix do I have to make this code run without error? #include <iostream> using namespace std; int main(int argc, char** argv) { int anoNasc, idade, anoAtual = 2020; char categoria; cout…
-
0
votes1
answer800
viewsedges of an N x N matrix
I would like to know how to set the edge values of an array to -1. I tried to create an array of N+2 x N+2, and to do with one just, go through the edges, but when I put to print it displays some…
-
0
votes1
answer44
viewsReading values from a string
I just started studying c++ and I don’t quite understand it yet. I need to get a lot of information on each line of a string vector, so I thought I’d use the sscanf, however I am getting the…
-
0
votes1
answer1147
viewscounting how many days left to finish the year
I was making a program in c++ to count how many days to finish the year from a date in the format dd/mm/yyyy but according to the date of the month I enter it always gives the same result type: if I…
-
0
votes1
answer168
viewsWhat does the syntax " bool Operator < " mean in C++?
I looked for that reference (bool operator < and bool operator ==), I found some explanations, but I didn’t understand it very well. How this syntax works? Code: bool operator < (nome a, nome…
-
0
votes2
answers88
viewsHow can I split a string by semicolon and take the value of each position after the while?
How can I make one split of a string per semicolon and take the value of each position after the while ? Example: result[0] //casa result[1] //carro My code: char str[] ="test;car;bar;mouse"; char *…