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
-
-1
votes2
answers255
viewsMy program only runs the first if?
I need to work out an algorithm that takes 3 real values and checks whether these values can be the side lengths of a triangle, and in this case, return what kind of triangle is formed. Why x, y and…
-
-1
votes1
answer380
views"Local variable not initialized p used
I’m developing a c++ program to learn malloc, but is giving local variable error in main function: // testeMalloc.cpp : define o ponto de entrada para o aplicativo do console. // #include "stdafx.h"…
-
-1
votes1
answer45
viewsDoubt in the use of the to_string function
In an exercise that I’m doing, it was proposed to read two numbers, an integer and a real, and count how many digits they have. Entry and exit should be like this: Entre com o numero inteiro: 2345…
-
-1
votes1
answer209
viewsUsing threads in classes
Hello, I have a problem regarding the use of threads. Once I use mingw to compile my projects, and this header is not implemented, I use this header to compile my projects. However, I am having some…
-
-1
votes1
answer61
viewsFile import. txt C++
When I import a space is added at the beginning of the text. example: "A" How do I ignore him ? Texto::Texto() { string pal, arquivoNome; char *palavra_aux; int i = 0; char *token = NULL;…
c++asked 6 years, 3 months ago user122010 -
-1
votes1
answer84
viewsDifficulty with If/ Else
Hello! How are you? I’m having a problem when I run my program, it’s a program to calculate four medias and divide by four, and it’s necessary to do this using If and Else, but when I run it, the…
-
-1
votes2
answers59
viewsInteger values on the terminal
I need to sum the odd numbers between two values. In online compilers the code works as predicted, adding any odd input values and giving the expected output, but in my terminal (4.15.0-34-Generic)…
-
-1
votes2
answers562
viewsHow to use ("%10.2f",&d) in C I want the number to come out integer
#include <iostream> #include <stdio.h> int main() { int a,b,c,d; printf("Escolha Qual das equacoes se adequa a sua duvida de 1 a 3\n\n"); …
-
-1
votes1
answer481
viewsLargest palindrome in a string? C++
I’m trying to make a code to be able to figure out, for example in phrases like, The blue macaw is beautiful! What’s the big one? in which case the answer would be: macaw I got to the code below but…
c++asked 6 years, 1 month ago Beginner Programmer 69 -
-1
votes1
answer2532
viewsHow to find prime numbers in a given range?
I need some help on that show, on the outside. Next, I need to print the prime numbers within that user-determined range A and B, the problem is that the program only prints a number within that…
c++asked 6 years ago Pedro Mateus 1 -
-1
votes1
answer70
viewsdoubt in array
My program needs to receive two vectors, A and B. This defines the set To Pikachu B as the set formed by the elements that appear in A or B. In addition, it has the set To Chikorite B as the set…
-
-1
votes1
answer75
viewsSomeone experienced who understands string manipulation well, who can help with this error
Good morning, I am presenting a problem that I have no idea the reason, I have tried to ask other people, none discovered the real reason for the error and how to repair it. Good my teacher, asked…
-
-1
votes1
answer55
viewsProblem with Double Chained List
My function - for now - can create a list and add items at the beginning or end of the list. But when calling the add item function, selecting 1 or 2, and entering the item, the program simply…
-
-1
votes1
answer97
viewsCorrect regex in C++ returning 0
Expensive, I created a regular expression for MIPS instructions. It was a lot of work, but I got it. At least regex. works, but C++ doesn’t. Here’s the code with the expression some string examples…
-
-1
votes1
answer57
viewsExercise with a map
Create a map which has three keys ("Local", "Resp", "Prioridade"). Ask the user to fill in this map and then show the result on the screen. #include <iostream> #include <map> using…
-
-1
votes2
answers237
viewsCode conversion is giving error
I am trying to convert a code from C++ to C and doubts have arisen. The code starts like this: #include<bits/stdc++.h> using namespace std; void function(int x, int y, int z, char &teste,…
-
-1
votes3
answers319
viewsBuild error in C++
I need to make a loop (Repeat-Until), but is giving error. #include <iostream> #include <cstdlib> using namespace std; int main (void){ char deseja=1, valordomes1, valordomes2,…
-
-1
votes2
answers138
viewsProblem in realizing the sum of the lines of a two-dimensional matrix C++
include include using namespace Std; int main() { srand(time(0)); int bid[3][3]; int impar = 0; for (int x = 0; x < 3; x++) { for (int y = 0; y < 3; y++) { bid[x][y] = rand() % (386 - 0 + 1) +…
-
-1
votes2
answers528
viewsWriting in a C++ matrix
I am studying and implementing some C++ schemes but it is causing errors when assigning value to the matrix. Well... I have a txt file that contains lines with "[email protected]" content. My Ret…
-
-1
votes1
answer63
viewsStruct member print print something strange
I’m doing a job that uses struct it’s all right but when it comes to listing the last one comes out with a strange character. My code is like this struct livro_cadastro{ int codigo; char obra[30];…
-
-1
votes1
answer149
viewsVisual Studio Transfer Control bypasses the startup of:
switch (option) { case 1: int var; std::vector<int>v(size); std::list<int>l; std::cout << "Digite os elementos do container (vector): "; for (int i = 0; i < size; i++) {…
-
-1
votes1
answer27
viewsDynamic filename usage for file creation
I want to create files with dynamic names for storing logs, however, I have no idea how to get the name I want and also do not know how to format the string and use it with the "path/filename.txt".…
-
-1
votes1
answer68
viewsI am unable to print the notes, which would be n1 and N2 of the list, I do not know if the parameter sent to the function is correct
#include <stdio.h> #include <stdlib.h> typedef struct nota n; struct nota { float n1; float n2; float mf; struct nota…
-
-1
votes1
answer63
viewsWhy can I still access a variable in the heap even after the function is over?
A while ago I learned about heap and stack, I was testing some codes when I came across a strange behavior in heap see; #include <iostream> using namespace std; void Test1(int *i[]); void…
-
-1
votes1
answer176
viewsTraverse a vector by dividing the search into threads
Hello, I have a problem, I have a college assignment where I have a very large vector, where I have to get each processor thread through a part of that vector increasing the speed of the search, but…
-
-1
votes1
answer75
viewsChar matrix reference error
I’m trying to make a code for questions, however he error, I believe it’s time to pass the matrix by reference. Code to follow: #include <stdio.h> #include <stdlib.h> #include…
-
-1
votes2
answers58
viewsHow to return different structures in a function with a value defined in Runtime?
Hello, I am working on a project for Windows that has a structure (of Windows itself) that changes according to the architecture of the system (x86/x64), how to return the correct structure for a…
-
-1
votes1
answer97
viewsHow to remove the string from a given range
Hello, Guys, I’m recalling programming (c++) and I took a little project to make one of a program that reads barcodes, records in a vector. Within each code read between characters 24 and 33, has a…
-
-1
votes1
answer147
viewsScale console to more than 800x800 visual-c++
Why can’t I resize the screen with 1400x900 "widthxheight"? More precisely the width because I saw that the height I can enlarge with more than 800, 900 and with 1000 it already exceeds the windows…
-
-1
votes2
answers205
viewsHow to store data from a struct in a vector (c++)
I’m having trouble storing information inside a vector. I need to store information like a user’s name, password and account number, so I’m using a struct typedef struct { int conta; string nome;…
-
-1
votes1
answer82
viewsC language - Infinite loop, not doing the comparison of vectors as I planned
Good afternoon. I’m doing an exercise, I developed a solution but it’s not working, I’m a few days ago trying to solve but. Write a program that reads the age and first name of 10 people. Your…
-
-1
votes1
answer127
viewsHow to Solve C++ Visual Studio Compiler Problem?
I was trying to do a Hello World in C++ in Visual Studio, but when trying to compile and run the program no bug was displayed, only a C/C compiler error message++. I already installed Minggw, and…
-
-1
votes1
answer91
viewsHow to change the attribute of an object received per parameter in a method?
I’m trying to implement a very simple example of using classes in the C++ language. Well, in short, there are two objects (cliente1 and cliente2), which represent two bank accounts. Within the class…
-
-1
votes2
answers58
viewsHow to access vectors of a class in C++
**I am familiar with pure C language because I develop embedded systems and microcontrollers. I am dedicating a lot in the studies of a new paradigm of programming that is object orientation (OOP).…
-
-1
votes1
answer29
viewsQuick Sort array implementation error
When presenting the elements of the vector, there are strange numbers that do not correspond to those entered by the user. I would like to identify where the error is. #include <iostream>…
-
-1
votes1
answer49
viewsCode does not execute instruction correctly in C++
I have a code on main that works normally. This code says that the user must enter the data and asks the user to enter the name of the employee and the following instruction starts object I1. The I1…
-
-1
votes1
answer33
viewsrepeated number vector program
I need to create a vector that in case see what the repeated numbers and give as output it, but if there are 2 values that have the same amount of repetition the output has to be the highest value…
c++asked 4 years ago Davidfranca9 11 -
-1
votes1
answer114
views -
-1
votes1
answer33
viewsHelps in allocating memory for a struct
int main(){ setlocale(LC_ALL, ""); cout << sizeof(Livro); paragrafo(); int cont; Livro *livros; while(true){ int op; cout << "1) Maior de 3 números"; paragrafo(); cout << "2)…
-
-1
votes1
answer58
viewsHow do you transform a Class from c++ to c?
I’m needing to turn a code into c++ for c (I know, backward), I’ve already transformed the prototypes part of the functions, which would be the .h. file. c he calls this class separated with :: How…
-
-1
votes1
answer55
viewsHow to create a multidimensional array in c++?
I have a matrix float m2D[4][4]. For the purposes of my program, I need at the same time to change the values in the components of m2D be able to save the status prior to that change. It’s basically…
-
-1
votes1
answer42
viewsDestroy array in C++
Speak devs, I’m trying to destroy the Wheel array but I get an error message: error: expected Primary-Expression before ';' token How can I fix the error? Follow my files if you can take a look:…
-
-1
votes1
answer32
viewshow to solve matrix vector code problems?
Hello, could you help me solve this problem in my code ? In the case it was asked to develop an algorithm that performs an encryption on a text. The algorithm must invert the characters of each line…
c++asked 3 years, 7 months ago Eduarda PS 1 -
-1
votes1
answer45
viewsIssue of matrices
Well, the question may be that for what Write an algorithm that reads an array A(5,2) and write it. Check, below, which elements of To are repeated and how many times each is repeated. Write each…
-
-1
votes3
answers91
viewsMake a program that receives 5 numbers and show the following output:. C++
I’m having difficulty formatting the output code is working right, someone has idea how to fix the output #include <iostream> #include <cstdlib> #include <clocale> using namespace…
-
-1
votes1
answer16
viewsVector-Column Program
I am trying to make this program read the first 4 columns and calculate the final note and the average, but I cannot put the correct solution in the arithmetic mean. #include <stdio.h>…
-
-1
votes2
answers41
viewsCompare strings within C++ file
Good afternoon everyone, here’s the problem. I have data inside the txt file and when in the program the user is asked to enter login and password for comparison, it simply stays in a loop. Can…
c++asked 3 years, 7 months ago Bruno Bernardes 1 -
-1
votes1
answer30
viewsHow to create multiple objects from a struct having its user-defined values ( Pointers and Malloc)
Then, in the exercise I need to display at most 10 products with name, quantity and value entered by the user using the terminal and then display everything on the screen. But I only know how to…
-
-1
votes1
answer25
viewsCreate and call a c++ template function
I have this template below, and when I try to call with the excerpt below, it can’t find the reference template<typename T> double power(T base, T power) { double result = base; int j = 0; do…
-
-1
votes1
answer25
viewsCode issues for a lap counter on a line-follower robot on the Arduino
Hello, I am beginner in the programming study with Arduino, and my teacher asked for the following exercise: "Using the line follower code implemented in previous lessons, the student must implement…