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
-
-2
votes1
answer38
viewsRemove whitespace excesses from a string
I need to make a program that reads a text file, copies the information and transfers it to another file, but without the blank lines, without comment code (which starts at "//") and remove excess…
-
-2
votes1
answer77
viewsDynamic stack - Compare values
Hey, how you doing? So, I needed to do a function on a dynamic stack to test whether two stacks containing integers are equal, i.e., to see if two values are of the same content and in the same…
c++asked 3 years, 8 months ago JosivaldoCorreia 1 -
-2
votes1
answer95
viewsFunction that copies chained list in another chained list (excluding repeated elements) does not work
/* I need to create a function that copies a chained list passed as a parameter to another chained list (except repeated elements, if any). This is my current code #include <stdio.h> #include…
-
-2
votes1
answer28
viewsMatrix, Float, matrix position
Could someone show my error? I had to leave a 3x3 matrix, I just need the output to be like this: 0 0 0 0 0 0 0 0 0 #include <stdio.h> #include <stdlib.h> #include <conio.h>…
-
-2
votes1
answer26
viewsPlay multiple. txt files and show content - c++
I need your help, I have several files. txt with text and I want my program to ask the user for the filenames and store the contents in memory and then display their contents. I made some code but I…
c++asked 3 years, 6 months ago Miguel Gonçalves 1 -
-2
votes2
answers68
viewsScanf does not work even forcing to ignore the spaces
I’m trying to make a simple program to start messing with C. #include <stdio.h> #include <stdlib.h> #include <locale.h> int main(void) { char nome[100]; char dataNascimento[10];…
-
-2
votes1
answer41
viewsHow to create optional parameters in C++?
In Python it is possible to have optional parameters in a function. It would look something like this: def soma(n1, n2 = 5): return n1 + n2 print(soma(5, 7)) If a second parameter is not passed n2…
-
-2
votes1
answer56
viewsCreate and use DLL libraries written in C++ on . NET C#
Because of the fact. NET is reversible, I need to encode part of my program in C++, but I still need Windows Forms, so I thought I’d create Dlls written in C++ to perform some key tasks (like…
-
-2
votes1
answer48
views -
-2
votes0
answers61
viewsHelp to solve this BUG, I am beginner. C Language
Follow code in full, below. I’m quite beginner yet, so there may be more mistakes. #include <stdio.h> #include <string.h> #include <stdlib.h> #include <locale.h> //Var char…
-
-2
votes1
answer25
views -
-2
votes0
answers11
viewsCold Blocks cannot identify the compiler in the mingw folder
Hello, I did the installation of the hall (codeblocks-20.03mingw-setup.exe Fosshub or Sourceforge.net) windows 7 system 32 bits. I believe the correct version is the one I installed (Code Blocks…
-
-2
votes0
answers16
viewsAccurate puts counter when reaching determined how much vote issue result and adc function that closes program
#include<stdio.h> #include<stdlib.h> #include<string.h> main(){ int n, b, p1, p2, p3, t, opc, c1, c2, c3; printf(" Digite 1 para votar no candidato 1! Digite 2 para votar no…
-
-2
votes1
answer17
viewsERROR C++ IVALID OPERANDS TYPES 'FLOAT' and 'FLOAT' to Binary 'Operator+'
#include <iostream> #include<stdio.h> #include <stdlib.h> using namespace std; /* run this program using the console pauser or add your own getch, system("pause") or input loop */…
c++asked 3 years, 2 months ago Henrique Ianni Silva 1 -
-3
votes2
answers216
viewsLoop End Error (Bug delete with char*)
1 - I have this code (Gave An Abridged, Type -1, And Then 'n' To Exit The Loop And Make The Mistake): #include <iostream> #include <cstdlib> #include <cstdio> #undef max using…
-
-3
votes1
answer1148
viewsHow to select positions of the matrix/ random draw?
Good morning! I need to do a random draw of the elements of the matrix to know if there is a boat (boat=1). As well as, at the end of 10 attempts need to print with (x) the successfully bombed…
-
-3
votes2
answers3399
viewsCreate an algorithm to identify days of weeks in c++
How to crack an algorithm to identify day of the week (numbered 1 to 7) and day of the week, weekend, or an invalid day?
c++asked 7 years, 8 months ago Charles Luis Charles Chidula 1 -
-3
votes1
answer39
viewsLimit a specific value to a string
need to limit and a specific value that would be 511 char command[512]; I tried with char command[512]; scanf("%511s",command); if (StrToInt(command))>511) printf("FIX ATK"); and that too char…
-
-3
votes2
answers323
viewsHow to isolate higher order bits and lower order bits in C/C++?
I need to create two functions One receives an integer value and returns another one containing only the 8 bits of the lowest order of the original value, with the remaining bits set to zero. The…
-
-3
votes3
answers238
viewsError while trying to overload Operators with dates
I’m trying to overload operators for dates, but if I use a double overload it gives error. What I actually want to do is that if the user uses a separator defining a format he accepts and if the…
-
-3
votes1
answer403
viewsCreate classes and functions in c++
One can give an example of how to create the main, the . h, and the . cpp in c++? and also connect them all. For example, having a function that receives an input value a, having another class that…
-
-3
votes1
answer61
viewsProgram to print an array with the same number of rows and columns in descending order
I need to know what a program would look like to print an array the same way below, where the bottom line will always subtract 1 from the top number. I really tried to make a code but didn’t know…
c++asked 6 years ago Pedro Mateus 1 -
-3
votes5
answers5734
views -
-3
votes2
answers183
viewsIs it possible to convert an integer into an Array in C or PHP?
For example: num = 5634; array[num]; array[0] = 5; array[1] = 6; array[2] = 3; array[3] = 4; I explained in a very lay way I believe, but I wanted to know if it is possible for a variable to receive…
-
-3
votes1
answer71
viewsHow to insert data into the C++ string using the Geany IDE?
I’m studying String types in C. The most common was gets() however it was discontinued because of "buffer overflow". I would like to know what the equivalent function in IDE Geany to gets(). I’ve…
-
-3
votes1
answer81
viewsHow to go back at a specific point of the code in c++?
I need to go back into the code at three specific points and I don’t know how to do it. I need at different times of my code I need to return to one of the three points already established, but they…
-
-3
votes0
answers16
viewsProgram involving matrices and functions
I’m having trouble with this code. I have to read from the 9 digits of isbn and generate the scanner code, this is ok. But I have to do a repeat where the program only closes when the user type…
c++asked 3 years, 2 months ago Matheus Carvalho 1 -
-3
votes1
answer342
viewsComputational Geometry - How to check if two lines intersect only at the anchor?
Good guys, I need to do a show in C++ that receives a point A(x,0) a point B(x,0) that point To and B they are on the x-axis, always with y = 0. After receiving the point To and the point B, I have…
-
-3
votes1
answer59
viewsWhat flag could I use to stop the execution of the ler_disciplinas function?
#include <stdio.h> #include <string.h> #include <stdlib.h> typedef struct materias { char disciplinas[20]; char semana[7][15]; }materias; void ler_disciplinas (); int main(){…
-
-3
votes1
answer43
viewswant to create a struct of variable size and error program
i am trying to create a struct of variable size but always q do it in the second run of the loop the program hangs #include <stdio.h> #include <stdlib.h> struct produto{ int…
-
-3
votes1
answer86
viewsCan anyone identify the error in this code?
Guys I’m sorry for the kinds of questions I’m starting #include <iostream> using namespace std; int main(){ //essa parte até o "for(Nm1==Fim)" o geany encontrou erro string Nm1; float PrC=0,…
-
-3
votes1
answer80
viewsCoding conventions in C++
Hello, I’m learning C++, and I’m looking for best practices for creating variables, functions, classes and so on. I’ve researched the subject on the Internet, but I couldn’t find anything to talk…
c++asked 3 years, 11 months ago Luiz Fernando 345 -
-3
votes1
answer66
views(C++) How to make a program write to 2 different files?
I made 2 attempts, the first one is error, and the second one does not write. could help me? #include<iostream> #include<fstream> #include<string.h> #include<stdio.h>…
-
-3
votes1
answer128
viewsSeparate string that has no bounders
My intention is simply to take a part of a string that I know from position 0 to position 29, for example, contains a proper name. And from position 30 to position 45, is the phone associated with…
-
-3
votes1
answer44
viewsHow can I use python with c++?
I found that I can use two programming languages in the same program, but I don’t know exactly how to do this... I just wanted an idea in a very simple example to make the code work below and I…
-
-3
votes1
answer30
viewsInvalid conversion when using pointers (invalid Conversion from 'int**' to 'int' [-fpermissive])
I am learning about pointers and dynamic allocation and I cannot overcome this bug. Apparently the pointer is not accepting the value of type int, but I cannot understand why this occurs. #include…
-
-3
votes1
answer44
viewsI’m having a problem with my code I can’t bring the data from one function to another!
I’m having a problem with my code I can’t bring the data from one function to another!! in the case of Function sum I cannot print it in function print. Can someone help me 1 - Insert into a vector…
-
-4
votes1
answer137
viewsSWITCH Error - Sequential Search and Binary Search
#include <stdlib.h> #include <stdio.h> #include <conio.h> #include <iostream> #include <fstream> #include "pessoa.h" using namespace std; int main() { //CADASTRA…
-
-4
votes1
answer740
viewsid returned 1 Exit status in C
My code keeps giving this error and I don’t know what’s wrong: #include<stdio.h> // printf, scanf // Função principal int main(void) { // início do programa principal // Declaração das…
-
-4
votes1
answer295
viewsVariable type float does not receive valuation
Follows an excerpt from the code: #include <stdio.h> #include <stdlib.h> #define MVAIN 0.8592; #define MVAOUT 1.0282; #define ICMS 0.29; float ProdValue = 0, MVA = 0, ResultValue1 = 0,…
-
-4
votes2
answers101
viewsI need an explanation for the error in this C++ script
#include <iostream> #include <string> struct Brinquedos{ enum Objetos {Bola, Carrinho, Caixa, Dinamite}; void func(int st_Bola, int st_Carrinho, int st_Caixa, int st_Dinamite){…
-
-4
votes4
answers224
viewsMy program made in C++ is in infinite loop, how to fix?
My program skips right to the end. Doesn’t even enter to read. Follows code: #include <iostream> int main(void) { int i= 0; string nome; for(i=0;i>=10;++i) { cin>>nome;…
-
-4
votes2
answers104
viewsError in "break" in C++ code prevents compilation
Follows code: #include <iostream> using namespace std; int main() { float n1, n2; int s; float resul; cout << "Digite um número para começar" << endl; cin >> n1; cout…
-
-4
votes0
answers34
viewswhat shortcut do I use to format the structure there?
Hello! My codes sometimes by the speed of the typing are structured (messy), how do I go back? VS use type: /* int variable; cin >> ; switch (expressao){ case: break; case2: break; default: }…
c++asked 3 years, 4 months ago Fabricio José Razera 1 -
-4
votes0
answers23
viewsGood afternoon, I’m a beginner and would like your help
Oops guys, I’m a beginner in the field and would like course tips, or any other kind of improvement and improvement in my C/C language development++. I am in the 2nd period of Computer Science and I…
-
-4
votes1
answer79
viewsRuntime error, c++, I don’t know why// is this problem ( https://www.urionlinejudge.com.br/judge/problems/view/2857)
#include <iostream> #include <cstring> #include <vector> #include <algorithm> using namespace std; #define MAXN 100100 //int…
-
-5
votes1
answer106
viewsArrays in loops
I could not resolve the following doubt: Fill in the blanks to print all elements of a array arr containing 3 elements: for(int x=0; x<___; x++){______<<______[x]<<endl;}…
-
-7
votes1
answer89
viewsTricky problem
How to make in C++ a program that prints the user’s number as follows: 5 4 3 2 1 5 4 3 2 5 4 3 5 4 5 This is too complicated for me.