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
answer79
viewsAllocate space to a double vector vector vector
I’m trying to allocate space in memory for a double vector vector vector. I know that for a vector vector I can do vector<vector<double>> Vetor(51, vector<double>(47, 1)) And this…
-
0
votes1
answer91
viewsCan anyone explain why this is possible? C++
#include "stdafx.h" #include <iostream> using namespace std; class S { public: S() { } S& operator=(S&) { std::cout << "copy assignment" << std::endl; return *this; } };…
c++asked 6 years, 8 months ago Strawberry Swing 177 -
0
votes1
answer583
viewsC++ While iterator skipping Cin.getline reading
I am starting in C++, during some tests I noticed that after the second iteration of while the Cin.getline command was not read displaying the line after it. I don’t understand what happens. Follow…
-
0
votes1
answer72
viewsc++problem: Selection Sort
hi wanted a help to solve a problem of c++: I am making a code and used Selection Sort but it is with a bug in the output results void select_sort (int vetor [TAM]) { int menor,aux; cout <<…
c++asked 7 years, 5 months ago Diego Noldin 1 -
0
votes1
answer119
viewswebview app doesn’t work perfect with Youtube
Create a webview app from my site, on the PC it works perfectly www.pipocaplayfm.com now on the webview it does not play the videos as on the site - App link…
-
0
votes1
answer5276
viewsHow do I use power in C++?
I’m making a simple calculator, and I wanted to add power. I’ve tried to Pow() and did not give, need to add some class?
-
0
votes1
answer51
viewsList with 3 c++ elements
I’m using list in c++, and in what I think its internal structure should contain: Content pointer to the next element It is possible to place one more variable within this structure, as the example…
-
0
votes1
answer38
viewsExcerpt execution time of a code with an accuracy greater than 0.001 seconds
I need to compute the execution time of sorting algorithms. I did the following: steady_clock::time_point t3 = steady_clock::now(); quickSort(v, 0, n - 1); steady_clock::time_point t4 =…
c++asked 6 years, 7 months ago Andre Luiz 115 -
0
votes1
answer802
viewsError while trying to compile files. h in c++
The code is this: #include "stdafx.h" #include "classeID.h" #include <iostream> #include <string> using namespace std; int main() { id label("default", 0); cout << "Nome: "…
-
0
votes1
answer43
viewsVisual studio runtimelibrary error
This shows the following runtimelibrary error: Error LNK2038 Mismatch Detected for 'Runtimelibrary': value 'Md_dynamicrelease' doesn’t match value 'Mdd_dynamicdebug' in Aimbot.obj INDIGO C:…
-
0
votes1
answer186
viewsHow to pick a pointer from a class c++ vector
How do I pick a pointer from a vector of class c++? For example I have a vector a; how do I receive a pointer to only one vector element?
-
0
votes1
answer641
viewsHow to show image in Opencv?
I would like to take a part of an image play it in an array pass some kind of filter on it manually( without using the Opencv functions) and show the result in a window for the user. For that I want…
-
0
votes1
answer72
viewsClass definition
When I studied about defining a class it would be like this in the header: class Jogador { int id; std::string nome; int vida; void setNome(); std::string getNome(); } However I am seeing a little…
-
0
votes1
answer278
viewsC++ Heterogeneous list
I’ve been searching the internet for weeks about lists (vector, array, list) heterogeneous in c++, however, in all websites and forums, the answer is the same: boost::any, but I wanted a way to do…
-
0
votes1
answer57
viewsHow to get Thread Stack?
I’m trying to create a program to get the thread stack, like the image, someone has some way to get it?…
-
0
votes1
answer104
viewsHow to print fraction in floating point format?
How can I print a fraction in the floating format in C++? I searched what this format would look like, but found nothing. E.g : 5 __ 3
-
0
votes1
answer40
viewsWhat is the best way to group objects in SFML?
If I have for example 3 different shapes in SFML, and I want to rotate them all relative to a single center, as if these 3 shapes were inside a square, what would be the best shape? Would it be…
-
0
votes1
answer7637
viewsConvert Int to String in C++
How do I make for the String resultado receive the value int of cont3 and the value char of c[cont]? resultado=" "; resultado=resultado+to_string(**cont3**)+to_string(**c[cont1**]); I tried to use…
c++asked 6 years, 6 months ago Gabriel Félix 13 -
0
votes1
answer322
viewsHow do I use the fopen command?
Whenever I try to use the fopen command Visual Studio returns me an error saying that such command is insecure, and that I should use fopen_s, but in case I do not know what direction to take with…
-
0
votes1
answer81
viewsPaint pixels in c++
Hello, I needed a function to paint pixels on the console. I came up with a solution here but when compiling gives me the following mistake: C: Users user user Appdata Local Temp ccORhjHu.…
-
0
votes1
answer274
viewsINTERNAL COMPILER ERROR Visual Studio 2017 with SFML
I’m having a problem compiling a code in visual studio 2017 with SFML libraries, when I try to compile it gives the following error: INTERNAL COMPILER ERROR in 'C: Program Files (x86) Microsoft…
-
0
votes0
answers40
viewsRemoval of txt files in C++
I made a mergesort sorting program for a giant txt that cannot exceed such a user-defined primary memory limit, and so I had to split 1 txt into several other temps, the problem is, depending on how…
-
0
votes2
answers774
viewsHow to randomize an Array in c++
There is a lot of material here about arrays ordering methods (quicksort, bubblesort, etc.) but I wanted to know if there is a "clutter" method of arrays, i.e., shuffling the elements of an array.…
-
0
votes1
answer253
viewsStructure for search and quick insertion c++
I have a program that adds several elements to a vector. The amount is getting larger than 1000000, I need to add and when there is already the element I am adding, it returns the memory position.…
c++asked 6 years, 6 months ago Lucas Vieira 397 -
0
votes1
answer347
viewsHow to save records of a mysql query in C++
I’m using a C++ library that does the query in the database. My goal is to make a query, and save the data in a txt file, perhaps even manipulating to stay in json format. The problem is that I…
-
0
votes2
answers3167
viewsOperations with C++ matrices
To perform the sum of items of a matrix (primary diagonal and secondary diagonal) I was able to write the following code. Can someone help me dry up the code? so I can compare the codes... C++: And…
-
0
votes1
answer497
viewsC++: Data structure / Queue
I made a data structure algorithm. I put all my knowledge into it. I can’t find the error. I leave the statement of the year below: Make a program that creates two rows F1 and F2, size 10, each.…
-
0
votes1
answer191
viewsError when compiling C++ source code along with header file and member function file
Hello I would like a help with this exercise code. This is my first time trying to ask a question here. When I try to compile the file with the member functions Gradebook.cpp or the file containing…
-
0
votes2
answers422
viewsProblems converting integer to string (stringstream) c++
#include <iostream> #include <string.h> #include <sstream> using namespace std; int main(int argc, char *argv[]){ int n, aux; string hexa=""; stringstream hexa_aux; cin >> n;…
-
0
votes1
answer133
viewsWhich software to use to generate a picture of a giant graph?
I have a program in c++, done with graph representation with adjacency list, however, there are more than 2 million nodes in it. Is there any software that has a text format, that I can generate…
-
0
votes2
answers147
viewsOrganization of projects with qMake
I’m developing a project and would like to start separating things into smaller parts and also to be able to test those parts, so researching found something about using the *.pri files to be able…
-
0
votes1
answer123
viewsCompare Plugin Notepad++ is it possible to use on VB6 or . NET?
I need to know if it is possible to use the Notepad++ Compare plugin in projects made in VB6 and . NET. If yes I would like some tips on how to use it. And I have no idea how to start The system I…
-
0
votes1
answer40
viewsEquivalent to _kbhit() and _getch() on Ubuntu
Guys, No Windows I used to use the following code: int userQuit = 0; while (!userQuit) { cout << "Algo acontece...\n"; if (_kbhit()) { char key = _getch(); switch (key) { case 32: { cout…
-
0
votes0
answers45
viewsObject Collision Check - C++ with Allegro5
How do I collide moving objects in C++ I want to know if the object can walk or not, but if it has an object of the same, it has to change direction. API : Allegro5
c++asked 6 years, 5 months ago Nádia Oliveira 1 -
0
votes1
answer58
viewsSomething like Getasynckeystate() for Linux systems, is there something similar?
I did a lot of research on the internet and couldn’t find something like Getasynckeystate() that isn’t in the windows.h library. Is there any library or path to follow that allows "direct" control…
-
0
votes0
answers94
viewsString and double data entry
I’m in a project to implement a C++ calculator that uses variables. Thus, if I define a variable x = 5, and type x 2 then returns me the value of 25. For this, I have to store the variable name and…
-
0
votes2
answers112
viewsWhat is the logic behind this challenge?
QUESTION: In football, teams fight over field space and score points in two different ways: through the touchdown, which can be worth 6 or 7 points and through the goal kick, which is worth 3…
-
0
votes1
answer303
viewsWriting in binary file
How do I write at any position of a binary file using the fstream library without overwriting the content already inserted in the file? I started trying like this: ofstream salvar;…
-
0
votes1
answer71
views -
0
votes1
answer392
viewsStatic int in class C++
Hello, the following code is showing error on the right: #include <iostream> using namespace std; class teste { static int x; public: teste () { x++; } } t1; int main () { return 0; } declare…
c++asked 6 years, 5 months ago Lucas Bittencourt 959 -
0
votes3
answers2499
viewsHow to check and print repeat values in a vector
I have the following problem to check the repeating vectors in a Vector: Given a sequence of n real numbers, determine the numbers that make up the sequence and the number of times each of them…
-
0
votes1
answer84
viewsNeed pull-down resistor
I’m using the function attachInterrupt() in the Arduino Uno to recognize the end of a course of an actuator. Normally test is used with if(), but the actuator cycle is very fast and the recognition…
-
0
votes1
answer62
viewsHow to pass structures to templates class functions
I just don’t understand why it’s wrong. This code works. template class test{ public: struct st1{ T a, b, c; }; struct st2{ T d, e, f; }; T foo1(st1 *st); st1 *foo2(); }; template typename test::st1…
-
0
votes1
answer40
viewsC++: Elements just below the constructor call of a class
In my teacher’s code, he passed the following class template, with the constructor defined below: template<typename T> class CircularBuffer { std::vector<T> _elements; size_t _first, _n;…
-
0
votes2
answers173
viewsIndependent member function in C++
I am learning POO with C++. I made a program here to train object arrays question. My question eh: The program is working, but was it efficient that I put the function display2 as independent? I…
-
0
votes0
answers43
viewsImprove interaction between files
I am creating a programming language in C++, and I intend to make some system to work with multiple files. In the simple build process, the interpreter creates files .cpp and .h and then compiles…
-
0
votes1
answer441
viewsProblem printing matrix c++
I’m trying to read an array and print it completely, but it’s only coming out the last line and I don’t know why. #include "matriz.hpp" #include <iostream> Matriz::Matriz(){ char matriz[0][0];…
-
0
votes1
answer60
viewsHow to prevent writing ' n' in the console
Hello, I have this code: #include <iostream> #include <windows.h> using namespace std; bool gotoxy(const WORD x, const WORD y) { COORD xy; xy.X = x; xy.Y = y; return…
c++asked 6 years, 4 months ago Simple coder 335 -
0
votes0
answers50
viewsError: cannot be called in the c++ argument list
I have been trying to use bunifu Transition in windows form c++, but without secession because of the error. In c# it would be "bunifutransition.showsync(dashboard);" but in c++ neither a c# to c++…
-
0
votes1
answer54
viewsConnection error mysql_query
#include <mysql/mysql.h> #include <iostream> MYSQL connection; void data_insert(); int main(){ mysql_init(&connection);…