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
answer362
viewsProblems with c++ function template (Reference not defined for class methods)
Hello! I’m trying to compile the following code: main: #include "lista.h" using namespace std; int main(){ no<int> *n; n = new no<int>(4); n->setProx(new no<int>(5)); cout…
-
0
votes1
answer29
viewsSegmentation fault error when printing 2D array - loop is not sending values to array
I’m not getting why of this error, Segmentation fault. Segment error, apparently. I have a code in which the user sends values that are recorded in an array. This array has two dimensions, the 2D…
-
0
votes1
answer96
viewsScreen Printing Problems (C Language)
I’m doing a job where it’s requested: The system to be built will need to meet the functional requirements below: 1 - Have your ID (RA-Name-Course) 2 - Have an option menu. 2.1 - Include the…
-
0
votes0
answers39
viewsgetline error does not read the file
I am trying to make a program that stores some data and then shows in the format ( matricula , name, Nota1, nota2) but when I run the code the program does not read the txt file and shows another…
-
0
votes1
answer37
viewsError with class destructor
Good morning, I am trying to develop a matrix math engine, the error that is giving in my code is this: R4DVector3n.cpp:(.text+0x226): undefined reference to `R4DEngine::R4DMatrix3n::~R4DMatrix3n()'…
c++asked 4 years, 4 months ago Codigo de Senior 562 -
0
votes1
answer314
viewsError to compile Opengl code
Good Afternoon, I use linux and I’m learning OpenGL, but when I go compile my code for that mistake: /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o: In function `_start':…
-
0
votes2
answers2230
viewssetlocale(LC_ALL, "English"); does not work in Visual Studio 2019
Good night to you all, I did a lot of research on how to solve the Portuguese language accentuation problem that occurred shortly after upgrading to windows 10 but to date unsuccessful. I will post…
-
0
votes2
answers478
viewsSearch in file . txt
I’m doing a college paper that’s asked to do a library book registration system, The whole part of the registration is already ready but the research part is missing, which is where I don’t know how…
-
0
votes1
answer28
viewscould you help me please . How do I order this struct by short Insert method?
How do I sort the struct using the short Insert I’m new to programming if you can help me please and explain , I’ll send the code I did : #include <iostream> using namespace std; struct…
c++asked 4 years, 4 months ago Fernando Rafael 19 -
0
votes0
answers47
viewsAccentuation in printing and blank fields
Good people, I am just about to explore the world of Velopers, so I will need a discount for the many mistakes in my little program. I didn’t find an answer here, so I’ll ask. The program below…
-
0
votes1
answer52
viewsHow to Count Integers Repeated Every 5 Values in an OR Vector to Each Row of a Table (Two-Dimensional Matrix, Example: matrix[3][5] ) C++
I have a vector that only has integers 1 and 2 randomly allocated. Example: int vetor[15] = {1,1,1,2,2,1,1,2,2,2,1,1,1,2,1}; How the vector would be printed: 1 1 1 2 2 1 1 2 2 2 1 1 1 2 1 I have…
-
0
votes1
answer34
viewsSDL is always generating transparent screen. c++
created and compiled a program in SDL, I do not know the reason, but it always returns a transparent screen, when the expected is a white screen. I’m using the following code: #include <SDL.h>…
-
0
votes1
answer122
viewsBubblesort reading and sorting of csv file in C
I am doing a work for the course and one of the questions is to make a code in C to: read a csv, sort it (using the Bubblesort method) and print on screen. I have this code that serves as a basis,…
-
0
votes1
answer781
viewsProblem "the file is already being used by another process"
I’m trying to make a code to call windows function ping and use output stream to windows file, and while using the code that the program calls on windows console right, but by the program I have a…
-
0
votes0
answers24
viewsError while trying to run a program via "Makefile" or via IDE
Currently, whenever I try to run a code (c++) I get this error message: I searched several sites and thought that the error might be in "Microsoft Visual C++ Redistributable", but I tried to…
-
0
votes1
answer23
viewsWhy does the matrix not exist outside the scope of readMatriz()?
I’m learning better C++ for marathons and I’m starting to use more methods instead of doing everything on main(), I need to read an array but I’m having trouble doing it through a method because…
-
0
votes0
answers27
viewsBuild error with header file
I cannot create classes with header file. When I create the file . h and create the implementation of member functions in the file . cpp gives error when compiling. I thought it was me, so I went to…
-
0
votes1
answer261
viewsHow to Read and Print String with c++ space?
I even managed to make my program read the String (name of a person) with space in C++. However, when printing only returns the first name of the person as in my program below. //Write a program…
-
0
votes1
answer41
viewsHow do I manipulate specific information from a TXT file in C++?
The file . txt contains the following lines: 1.55 66.5 1.80 90.2 1.66 65.1 1.70 70.0 1.65 58.8 1.58 53.5 1.72 68.5 1.63 67.9 1.71 69.4 1.67 62.4 I need to average the height, average the weight and…
-
0
votes2
answers69
viewsHow to see if a string has integer numbers
In this program he only analyzes whether the string has digits, but wanted him to analyze whether it has positive integers. For example: entree: a 1 b 12 c 3.14 -20 exit: a +1 b +12 c 3.14 -20…
-
0
votes1
answer43
viewsProgram error of average in C, in result view
I’m a beginner in C programming, and in college we had to develop a program to make the average of 4 notes, and after typed, make the display, the program works without syntax error, but there’s…
-
0
votes0
answers38
viewsError while compiling code in C++
I’m starting to learn POO in C++ and when I compiled the code gave a very strange error that I have no idea how to solve. I couldn’t find anything on the net to help. I thought I’d done something…
c++asked 4 years, 2 months ago Gabriel Bento 75 -
0
votes0
answers11
viewsALLEGRO - Error in flip_display when starting draw_bitmap
all right? My code is giving error when I start it, the error occurs in al_flip_display(); and it always occurs when I try to start the al_draw_bitmap(rline, 120, 220, 0); If I remove draw_bitmap,…
-
0
votes1
answer184
viewsError computing mean with vector C
I am trying to calculate the note average of an array in which I made dynamic allocation, but the following error appears: line 66- [Error] invalid Conversion from 'int*' to 'int' [-fpermissive]…
-
0
votes2
answers40
viewsRelate a user input to a class pointer
I would like to relate the class pointer corresponding to the user input and present on the screen the attributes related to that object. #include <iostream> #include "classes.h" using…
-
0
votes0
answers44
viewsHow to compile C++ code with separate interface? (Arq.h , Arq.cpp and main.cpp)
I’m studying C++ for the Deitel book and I’m trying to compile a program where we have a gradebook file. h which is the interface, gradebook.cpp which is the implementation and main.cpp. Whenever I…
-
0
votes0
answers24
viewshow to place a C++ relational operator?
The exercise is to Read the value of a purchase in the Stores Your Best Purchase and show the value of the installments according to the amount of installments desired by the user. The store is…
-
0
votes1
answer154
viewsError inserting elements into a vector - C++
I’m trying to call the job montVetorCodigo and montVetorPeca waste of main but I have tried several ways to put the elements of a TXT file inside a vector but it only stores the columns of the last…
-
0
votes1
answer128
viewsRelate two vectors/arrays of different types and sort them in C++
I have a file . txt from where I need to collect the data (will be placed below). The first column refers to the part code and the second refers to the piece name. I need to find a way to sort the…
-
0
votes2
answers40
viewsWhen I type 1 he doesn’t ask the questions dnv, and I can’t fix it
When the user chooses to continue (option 1) not appearing to type the sides of the triangle again #include <stdio.h> #include <stdlib.h> int main() { int x, y ,z, o; printf ("Informe o…
-
0
votes2
answers59
views -
0
votes0
answers42
viewsDuplicate the last line of the file . txt c++
#include <fstream> #include <vector> using namespace std; struct Produto { string nomeProduto,quantidade,marca,preco; }; void carregaProdutos(vector<Produto> &R) { ifstream…
-
0
votes1
answer220
viewsCopy one string to the other in C++
I am doing a school activity where I have a list of book titles. Each title stored in a string field of a structure. I need to sort this list alphabetically through the quicksort where I should also…
-
0
votes0
answers30
viewsQuestion about square numbers (perfect squares)
I need to make an algorithm that reads any number and checks if it’s quadrangular. If it is, show the next 10 quadrangular after it. If it is not, inform. #include <stdio.h> #include…
-
0
votes2
answers51
viewsC++ - pointer this
The Rotatex(float) and Scale(float, float, float) functions of the mat4 class return the this pointer. The purpose was to create a temporary instance of mat4 to store the pre-multiplication between…
-
0
votes0
answers33
viewsHow I take the space from the char when I type more than one word does not appear / on type the phrase
#include <iostream> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <locale.h> #include <ctype.h> #define MAX…
-
0
votes1
answer26
viewsHow to create a user-defined amount of objects?
I am creating a Bookshop and at the time of registering a new book, the user must say the amount of books that will be registered, but I am not able to do it, I can only create a preset amount of…
c++asked 4 years ago Pablo Goulart 13 -
0
votes0
answers22
viewsDoubt MATLAB code for Opencv C++
Good evening, everyone! I would like some help in relation to passing a code that is in Matlab to opencv c++. I’m trying to do some operations with rgb channels, but Thresh’s value is not the same -…
-
0
votes0
answers30
viewsWhy does overwriting the elements of a vector take the same time as the first time?
My goal with this test would be to compare the speed performance between these two functions: static inline void VectAssign1(int *const g , const int x , int n ) { // g[ i ] = x for each i = 0 .. n…
c++asked 4 years ago Andre Luiz 115 -
0
votes1
answer40
viewsHow to pass string to an insert function
#include<stdio.h> #include<stdlib.h> #include<string.h> struct lista{ char nome[20]; int idade; struct lista* prox; }; typedef struct lista Lista; Lista* lst_cria(){ return NULL; }…
-
0
votes0
answers29
viewsinvalid types 'double[int]' for subscript array
I have to do a Florentzproton function that takes two vectors and multiplies them using another Productovetorial function (which is in another class), then multiplies the resulting vector by a…
-
0
votes1
answer88
views"Expected Primary-Expression before 'float'", calling a function from another class
I need to create a Florentzproton function in the Physics class that takes two vectors (v and B) and multiply them using another Productovetorial function, of the Mathematics class, storing the…
-
0
votes1
answer40
viewsstand-alone trolley with two axis compilation error
hello.. I am beginner and am developing an altonomic cart and found an error in the compilation Arduino: 1.8.13 (Linux), Card:"Arduino Uno"…
c++asked 4 years ago natã e miriam Ramos 11 -
0
votes1
answer143
viewsVector comparison program C++
You guys all right? I’m beginner and I’m trying to build a program that compares two vectors and if all the elements of the two vectors are. I’ll exemplify it to get better... vector 1 = 10, 20 , 30…
-
0
votes1
answer34
viewsHow to print a dynamic list in c++?
Good evening! is my first post here so please in case I reported something wrong, feel free to fix it. I made a dynamic char list, but I’m having difficulty printing the entire list on the screen,…
-
0
votes0
answers70
viewsHow to correctly fill a Qtablewidget table in QT with C++
I’m trying to fill a table with data read from a text file. The file structure is formed by lines with pairs of numbers, i.e.: 0.0 1.0 1.0 2.0 2.0 3.0 I am implementing the following code to fill in…
-
0
votes0
answers29
viewsSET method does not modify vector attribute on object of a class
Follow the full code: // sistemafinanceiro.h #ifndef SISTEMAFINANCEIRO_H #define SISTEMAFINANCEIRO_H #include"banco.h" class SistemaFinanceiro { private: Banco banco; public: SistemaFinanceiro();…
-
0
votes1
answer222
viewsPrint array of names in C++
I’m having trouble printing an array that has as elements a char 'Name' saved. When I print these elements, only the last letter of the char leaves, in this case, the letter 'and', and not the whole…
-
0
votes0
answers24
viewsC++ Pass Array as parameter to a function
I have the following code that works correctly: typedef void(__fastcall* _PackEndFunc)(int Buffer); _PackEndFunc PackEndFunc; uintptr_t moduleBase = (uintptr_t)GetModuleHandle(L"processo.exe");…
-
0
votes0
answers98
viewsHow to calculate the bimonthly grades of 10 students
I have to make a code where you’re asked to develop a program that controls the bimonthly grades of 10 students in a classroom. The programme in question shall perform the following routines::…