Posts by Filipi Maciel • 395 points
19 posts
-
0
votes1
answer56
viewsQ: How to pass fstream variable to another function?
I am trying to pass a binary file that is already open to a function. However, I get the following error: error: use of Deleted Function. Code: void abreBin(){ fstream arq_bin("registro.bin",…
-
0
votes1
answer63
viewsA: How can we not access it with pointers?
The problem was revolving around the variables of the type String. The solution I found was the following: 1º) Change the type of the structure variables class RegistroVenda { public: float preco;…
-
2
votes1
answer63
viewsQ: How can we not access it with pointers?
I have a code where I create and then read a file .dat with information from sales records, such as date, time, price, etc. I can do a search by date, for example, and generate another file .dat…
-
1
votes1
answer134
viewsQ: A generic vector only works with pointers? Why?
Hello, I know it works: typedef struct stack TStack; struct stack { int size; int top; void **S; // <------ vai apontar para um vetor de ponteiros // tipo void*, que pode ser de qualquer tipo };…
-
0
votes2
answers263
viewsQ: How can I pass a parameter of any type to a generic vector? - C
I have a structure like TTabelaX, which is basically a table that I will store elements of any kind, ie I can create a table to store a type element TCarro, with plate and color, then I can use the…
-
0
votes1
answer169
viewsQ: free() in char dynamic stack does not work - C
Hello, I’m having trouble trying to release dynamically allocated memory. For small string there is time that works, but for large string the program tops. There’s a time when a 3-character or…
-
0
votes2
answers37
viewsQ: Redefining how a function operates? C
Hello, I have a question regarding a line of code below, see: #include <stdio.h> typedef float (*TPonteiroFuncao)(float, float); // O QUE ESSA LINHA FAZ? float soma(float a, float b){ return…
-
1
votes0
answers46
viewsQ: How to put the Caret (cursor) in the right position?
When I create a new method, it looks like this: void teste(){|} Note that the cursor is between {}, and when I press enter gets like this: void teste(){ |} Now the cursor is behind the }, and that’s…
codeblocksasked Filipi Maciel 395 -
3
votes1
answer252
viewsQ: Searching graphs to solve Euler’s theorem
Hello, I would like a help to do a search on a graph and check if it satisfies the theorem of Euler. The theorem says: "A connected graph will contain an Euler cycle if, and only if, each vertex has…
-
1
votes1
answer339
viewsQ: Why is the complexity cost of a BFS O(n+m)?
I need to show that the cost to know if there is a path between two vertices v and w is O(n²). For this I can make a BFS in a graph, only, the cost of a bfs is O(n+m), but I do not understand why it…
c++asked Filipi Maciel 395 -
4
votes2
answers9616
viewsQ: Read input data to EOF in URI Online Judge
Hello, I’m trying to solve the following problem below: However, I am having trouble putting this EOF condition in java. Here on stack I found attempts solutions, but they are related to using…
javaasked Filipi Maciel 395 -
2
votes1
answer794
viewsQ: How to generate Adjacent Matrix of a BFS from a txt file? C++
I’m using the Codeblocks. I have a. txt file that represents a maze, everything that is after the : are rooms: The first line of the file shows the start coordinate, which in this case is AS. Every…
-
1
votes1
answer1326
viewsQ: How to deal with the use of getline() in a for(;)?
I’m storing author names of books in a string array. for(int i = 0; i<qt; i++) { cin >> nome; NOME[i] = nome; } But I want to have the full name, first name and last name, so I thought I’d…
c++asked Filipi Maciel 395 -
0
votes1
answer51
viewsA: Classico "Execution of C: . . . failed" in codeblocks
I solved my problem! CB was installed on ...(x86) I just reinstalled in another directory, then compiled and ran normally using F9 !
canswered Filipi Maciel 395 -
3
votes2
answers452
viewsQ: Can I use a char in an arithmetic operation in Java?
The following code doesn’t work, but I thought something along those lines: char op = '*'; ... r = (y op x); I want to change the characters of op to do different operations, it would be possible in…
-
4
votes1
answer488
viewsQ: How to make my own commands and shortcuts in Eclipse?
What I mean by my question is that, for example, when I use sysout and Ctrl+Space the method line System.out.println(); is ready for me to use, reducing my time to type everything. I wonder if you…
-
0
votes1
answer51
viewsQ: Classico "Execution of C: . . . failed" in codeblocks
I’m having this problem in codeblocks where when I try to run any program in it I get Execution of 'C: Program Files (x86) Codeblocks/cb_console_runner.exe "C: Users Desktop Client C test.exe…
casked Filipi Maciel 395 -
0
votes1
answer227
viewsQ: Eventually java.lang.Arrayindexoutofboundsexception occurs
I made a simple algorithm of a book and there are two possible results. To test these results I have to run the program several times until Math.Random() generates the possible numbers and displays…
-
3
votes2
answers768
viewsQ: String of characters inside the scanf. Why and how does it work scanf("Day %d",&dia);?
Problem I was making a code that would read a string and then an entire value: int dia, h, m, s; char dp; //Dois pontos. scanf("Dia %d",&dia); //Inicio do evento. ... I thought of creating a…