Posts by Kyle A • 466 points
12 posts
-
5
votes1
answer146
viewsA: What is Tree Depth and height?
A tree has height ('height') and diameter the width ('Diameter' the 'width'). Height - The number of edges on the course between the root node and the most distant leaf node. The height of the tree…
-
0
votes1
answer84
viewsA: Difficulty with If/ Else
You are not giving an initial value to recMedia. When you have the result "OK" in the first 'if', there is no way to know what is the value of recMedia. Give an initial value to all variables.…
-
0
votes2
answers160
viewsA: What are "weak references"? When to use them?
Victor’s answer explains what weak and 'strong' references are, but I’ve never heard the one about cache with respect to weak references. The reason I use weak references in C++ has to do with…
-
3
votes1
answer64
viewsA: Vector return problem in c++
There are two errors at the end. You gave a value to aux, but never used it. It’s also increasing c in both ties for, when it should increase i in the second loop. I think you wanted to: for(int c =…
-
0
votes1
answer91
viewsA: How do I get data from a file with fscanf, in c?
You need to read the text before the numbers con fscanf(). fscanf() will start searching for a number (because of the %d at the beginning of the formatting text) and soon find mdb236r1, which is not…
-
4
votes1
answer687
viewsA: What are the most common C++14 compilers on Linux?
I use GCC (GNU Compiler Collection). GCC supports full C++14 since GCC 5 (GCC C++ Support - English). Almost all (if not all) Linux distributions support GCC. To enable the new C++14 features, use…
-
2
votes1
answer95
views -
1
votes3
answers1588
viewsA: Python Floating Point Problem 3
Like Pedro said, it’s not a Python bug. If you know that the increment will always be 0.2 (or any fixed number), you can simply store the values multiplied by 5 (the multiplicative inverse of the…
-
2
votes2
answers265
viewsA: Unexpected result in using Parallel.Foreach
Gabriel Coletta is right. List is not thread-safe. Whenever you have code in parallel trying to write to a single structure, you have to verify that the code does not conflict. An example that shows…
-
0
votes1
answer83
viewsA: Chained List Value Printing - Pointer Problem (C Language)
The call of imprime_nomes is out of the main. The main should look more like: int main(){ registro *p1_main; lista *p2_main; int escolha1, escolha2; criarLista(&p2_main); //cria a lista para…
-
1
votes1
answer59
viewsA: Error in reading file
The problem is that you are opening the file in each function. Instead of calling entrada = fopen("entrada.txt", "r"); within the functions, you must pass entrada as int LeNumeroDePontos(FILE*…
-
3
votes2
answers1785
viewsA: Call cd command in c++ using system()
If you are making a shell, rather than calling 'system' is calling 'Fork' and 'execvp' in Linux or 'Createprocess' in Windows. Some examples for Linux are given in English by others who are also…