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
answer73
viewsIn C language working with strings would it be better to spend processing or memory?
In general in programming it is better to spend resources on processing (calculations) or memory (creating variables)? Contextualizing: I am developing a solution for a program that uses struct and…
-
0
votes0
answers125
viewsC/C++ How to declare a type for event handler in a class?
I need help in C/C++ to know how to define a type for event handler that will be used as a class member. This is an example that works with simple variables and functions: #include "cstdlib"…
-
0
votes0
answers110
viewsAbout Snippets in VS Code
hello, I use Visual Studio Code, I’m a beginner in programming and I wanted a help to assemble snippets in VS Code, I wanted to create snippets for basic functions of C language, like printf and…
-
0
votes1
answer69
viewsHow to make strftime accept a Std::string?
I put together a small example of how I tried to do it, but the string is empty, not receiving the value. IMPORTANT I want to change only the strftime(). I tried to use, unsuccessfully…
-
0
votes1
answer303
viewsSimply chained list - Method problem
I’m having a problem with the method delete_find_number of my code. It is as follows: this method must exclude a specific number which is passed as a parameter. After receiving the parameter, this…
-
0
votes2
answers179
viewsIs there realloc() in C++?
The realloc() is unique to C? Would it have any function that would be equal in C++?
-
0
votes1
answer60
viewsWhen a C program is compiled, does it include all the dependencies necessary for its operation?
When I compile a program in C, will all dependencies be compiled together? If not, it is possible to compile them? For example, if I include a certain library in my program, when I compile it, I…
-
0
votes1
answer91
viewsHow do I insert elements of a first vector into another second vector, at a given user position? and still print step by step
Entradas - Tam do 1 vetor:5/ Elementos do 1 vetor: 1 2 3 4 5 / Elementos do 2 vetor: 6 7 8 9 10/ Pos a ser inserida: 1 Saida- 6 1 7 8 9 10 / 6 2 1 7 8 9 10 / 6 3 2 1 7 8 9 10 / 6 4 3 2 1 7 8 9 10/ 6…
-
0
votes1
answer255
viewsSomething equivalent to the sstream library from C++ to C
I need something similar to the stringstream you have in the C++ connection for the C language, I need it a lot because I want to make querys in a database using C (C mysql Connector). Since I had…
-
0
votes1
answer147
viewsSMPSEQ3 problem - Fun with Sequences - SPOJ
Good morning. I would like a help to create a code that is accepted by SPOJ. The proposed problem is the following: "You get an ordered sequence of n integers S = S1, s2, ..., Sn and an ordered…
-
0
votes0
answers1444
viewsWrite.txt file content to C/ C++ array
How do I take the values of a.txt file and place them in a name, phone and email array and sort them by name. I can’t use struct. #include <stdio.h> #include <string.h> #include…
-
0
votes1
answer62
viewsalgorithm to read age years, months, and years and convert the value to age only in days
#include <iostream> using namespace std; int main() { int idade; int anos; int meses; int dias; cin >> anos >> meses >> dias; meses= anos*12; dias= meses*30; cout <<…
-
0
votes1
answer65
viewsTake values from a vector and use in a function
I have a vector XC[i] where Gero with the code below: for(i = 0;i<N_Volumes;i++){ double XC[i]; XC[i] = (xC0+=delta_x)-1.0; printf ("XC[%d]= %f\n", i, XC[i])}; I want to take these values from…
-
0
votes1
answer701
viewsThread - Shared Memory Access Violation
I use a library to retrieve data from an Image (in unsigned char*), and use it to allocate to an Opengl Buffer (Texture). Since the image can be large, Opengl by default creates another thread to…
-
0
votes2
answers38
viewsHow to make a concatenation between a string and another primitive type in a function return?
I’m doing a function that returns all class information ContaBanco.h, as, the current balance, owner, type, etc, but the compiler understands as a sum and not as concatenation. How can I solve this?…
-
0
votes2
answers46
viewsImplementation of member functions
It was overloading operators and defining them within the class itself, I found it natural to do so for these functions, but then a small doubt arose. Is it wrong to define member functions within…
-
0
votes1
answer261
viewsHow to print a list array (a pointer to a list)
Hello, I would like to know how I can print a pointer to a list, as a vector of lists. I made a pointer pointing to list and do not know how to print these values. I tried using an iterator for each…
c++asked 6 years, 8 months ago Caio Teixeira 61 -
0
votes1
answer68
viewsWorking with C socket received data
I have a script that receives data via socket done in C, and I’m having difficulty working with this data. Data received from customer: "Imei:123123,23123,tracker,0.0......". I need to receive this…
-
0
votes1
answer66
viewsUse C++ variable in Assembly (Arduino)
I have an interesting code in this page. const uint8_t MachineCode[44] PROGMEM = { 0x25, 0x9A, 0x2D, 0x9A, 0x40, 0xE5, 0x5F, 0xEF, 0x6F, 0xEF, 0x6A, 0x95, 0xF1, 0xF7, 0x5A, 0x95, 0xE1, 0xF7, 0x4A,…
-
0
votes1
answer30
viewsHow do I get this matrix to zero in front of the F’s?
I can’t leave the matrix zeroed in front of the F’s. it’s just behind.…
-
0
votes2
answers129
viewsMatrix with C++ Strings
I would like to create a C++ Mxn array for storing strings, like the matrix below: [['3325309756482910474', 'CARRO', '2506794813021649539', '618.57'], ['3325309756485249504', 'MOTO',…
-
0
votes2
answers1681
viewsRecursive even numbers in C++
The purpose of the code below is, through a recursive method, to return the number of even numbers between two numbers placed by the user. I can’t understand why my method quant only returns 0.…
-
0
votes0
answers76
viewsC++ - How to pass a string to a class
I have a little problem when I try to pass a string to a class. In short: in the main program I will read this string and move to the class: cout << "----- Vamos as opcoes! -----" <<…
-
0
votes1
answer192
viewsHow to use map / create keys to store c/c++ cycles?
What is the most efficient c/c++ structure that I can use to create and store cycles, so that I can ensure that repeated cycles are not stored? I have a CICLO struct, such that: struct CICLO {…
-
0
votes0
answers25
viewsXOR operator in if
Hello, What is the meaning/result of the operator in the following if? char ch, str[32]; if(str[inf - 1] == ch ^ str[sup -1] == ch) counter++; I know that the goal is only one of the conditions is…
-
0
votes1
answer36
viewsVector creation in c++
What did the new int[2] in int* vetor = new int[2];
c++asked 3 years, 11 months ago Alexandre Lima 1 -
0
votes1
answer31
viewsProblem with DLL
Hello friends I am beginner in c++. How can I prevent people from injecting a dll into my program? they put a dll with the name IPHLPAPI in the folder of my program, then this intruder dll is…
-
0
votes0
answers23
viewshow to create multiple users in c++, taking words from a text file? results when I use only one *to_find*
#include <stdio. h> #include<string. h> typedef struct? char name[20]; int password[8]; } Adm; int main() { Adm adm 1, adm 2, adm 3, adm 4; FILE * login; login = fopen ("Adms.txt" ,…
c++asked 3 years, 10 months ago Cícero Sousa 11 -
0
votes1
answer22
viewsHow do I print the line that is the smallest element of an array?
#include <iostream> using namespace std; int main() { int m[4][4],i,j,menor; for(i=0;i<4;i++){ for(j=0;j<4;j++){ cin>>m[i][j]; if (i…
c++asked 3 years, 9 months ago Victoria Moraes 9 -
0
votes1
answer413
viewsExtending Parent Class method in C++
I have a sphere class : class CEsfera{ protected: double centro[3]; double raio; public: CEsfera(); CEsfera(double x, double y, double z, double r); mostra() { for (int i=0; i<3; i++) cout…
-
0
votes1
answer30
viewsI read the txt file, but it shows blank
I want to read a truth table from a txt file but it does not show anything of the file, nor the table numbers, nor any other character I have put to test #include<iostream>…
c++asked 3 years, 9 months ago Wesley Franklin 3 -
0
votes1
answer70
viewspass a struct using extern C on a . dll c++
I have a function that comes from a . lib that returns me a struct tabela GSTV(vector<double> inpA, vector<double> inpB); this struct is defined as follows:: struct tabela {…
-
0
votes1
answer88
viewsC++ - What are the effects of & Hexadecimal operator?
I’m with a project of a Gameboy emulator for android, so far what I got was: Identify the game type (Gameboy, Super Gameboy, Gameboy Color, etc). Identify the game region. Extract the game title.…
-
0
votes0
answers64
viewsProblem when compiling a source
I’m trying to compile a project, but this error is appearing: Gravidade Código Descrição Projeto Arquivo Linha Estado de Supressão Erro MSB8036 The Windows SDK version 10.0.15063.0 was not found.…
-
0
votes1
answer161
views -
0
votes3
answers95
viewsIdentify a specific word in a C++ String, is there a function ready for that? Or just in the nail itself?
Hello, I’m getting a series of strings(lines) from a . txt file and putting them into a vector. But there’s a problem, strings come with an unwanted start, example: Depende: lsb-release Depende:…
-
0
votes0
answers19
viewsDifference Cout and printf c++
I’ve been looking for content about the difference of Cout and printf for a while, but I still can’t find an easy, simple and direct explanation. I would like to know relationships about…
-
0
votes2
answers74
viewsWhen to use new and delete in c++?
I’m studying on pointers in c++, I still don’t quite understand how to use but I already have a notion, and one of the utilities I’ve seen is "dynamic allocation". I’ve heard of it in C language…
-
0
votes1
answer100
viewsvector<double> using ctypes for DLL in Python
I own a .dll that within it has a function BOLHA that returns a double. The problem is that BOLHA has a vector<double> in the argument. extern "C" minhaDLL_API double…
-
0
votes1
answer61
viewsHow do I make a char vector recognize a line break?
The code is like this #include <iostream> #include <fstream> using namespace std; int main(){ char frase[30]; char j; int i=0; do{ cin>>j; if(j!=' '){ frase[i]=j; i++; } }while…
c++asked 3 years, 8 months ago Victoria Moraes 9 -
0
votes0
answers17
viewsWhat is the "void" in c++?
I’m studying this new language in the data structure of my college. So far I’ve only programmed in Python and this is my first contact with C++, which would be this type void?
-
0
votes0
answers31
viewsIs it possible to make a static library (.lib) with inline function?
Uso Visual Studio 2019 Community. I asked on the forum and received no answers. I want to know if it is possible (if yes, how) in VC++ to declare (no body) a function or methods in a class in a ".…
-
0
votes0
answers53
viewsC++, create a list of "ids"
This is the code if (otherpages == 2) { ImGui::Columns(2, nullptr, false); ImGui::Checkbox("Enable Medal Changer", &Settings::MedalChanger::enabled); static int medal_id = 0;…
c++asked 6 years, 7 months ago Gabriel Demon 1 -
0
votes2
answers254
viewsCreate files in the Home folder with C++
In c++, creating files is very simple, just include the fstream library and use ofstream arquivo; open file("variables.txt"); But this generates the file in the project folder and I would like to…
-
0
votes0
answers11
viewsDifference between #include and #define pre-processor directives
What is the difference between programming the line of code: #include "filename.h" or #define FILENAME_H What makes the second line of code concrete?…
-
0
votes1
answer81
viewsWhat’s the malloc for?
I’m new to C++ so I have some questions. One of them I’ve seen in several codes around is the malloc function. What’s the use of malloc?
c++asked 3 years, 7 months ago user233184 -
0
votes1
answer25
viewsI wanted to know why not read the functions on the screen
#include <stdio.h> typedef struct { char titulo; char autor; float preco; } livro ; livro definelivro(char titulo, char autor, float preco){ livro l; l.titulo = titulo; l.autor = autor;…
-
0
votes1
answer417
viewsUse of c++ ASCII characters
Good afternoon, I have these codes in c++ and I would like you to explain to me why these codes are sending to the console seemingly random characters: cpp testing. #include <iostream>…
-
0
votes1
answer20
viewsInsert element per line of code in a Qt C++ form
I want to insert an element in a Qt form, but I can’t use the designer because the element should only appear when a button is clicked. Is there anything like a ui->addWidget method or some other…
-
0
votes0
answers99
viewsHow to use a Friend function within a class
My program is structured as follows : Classe.cpp // Implementation of class methods Classe.hpp // Prototypes of the class Main.cpp // Main file In my file Classe.hpp I have the prototype a function…