Posts by Wtrmute • 2,359 points
84 posts
-
2
votes1
answer2117
viewsA: How to correctly call a function through another function in C?
I note that the example code you posted does not compile: First, on line 12, you’re calling a function Divisibilidade(), when you certainly wanted to call divisibilidade3() (note the D capital and…
-
2
votes2
answers162
viewsA: Broken values in installments, how to insert in the first the 3rd decimal place?
As a last resort, you can always work with pennies: <?php $valor_total = 200.75; $qtde_parcelas = 3; function parcelas($montante, $parcelas) { $resultado = array(); $centavos = $montante * 100;…
-
0
votes2
answers1005
viewsA: How to get all the digits of a variable in C?
I suspect your teacher will simply imagine that you will turn the number into a string using snprintf(), and then iterate on the sequence: #include <stdio.h> #include <stdlib.h> int…
-
0
votes1
answer55
viewsA: Hidden tr problem does not show in right place after returned json
I’m not sure which preprocessor you’re using to use those elements @if/@foreach/etc, but it is clear that the problem lies in the order you construct these tables: <table class="table table-hover…
-
2
votes2
answers806
viewsA: What is the usefulness of auto keyword in C?
The keyword auto was included in the C language because it was the keyword for declaring local variables in the predecessor of C, the b language - and yes, I am serious. As B had no types, a…
-
0
votes2
answers189
viewsA: How to test if a string is a number in the C language?
Instead of going through the string several times looking for specific properties, it is best to examine once, considering the properties of a well-formed number: #include <stdio.h> #define…
-
4
votes3
answers524
viewsA: include library in C is required?
What’s the point of #include? The #include is a Preprocessor directive, that is, a transformation of the program text that occurs before the parsing itself. It takes a filename as a parameter and…
-
2
votes3
answers2438
viewsA: Doubt in Calculation of %
Remember, a percentage is a ratio between two values (and therefore one divided by the other) multiplied by 100. Using your example, you soon find out who should be divided by whom; then just…
-
1
votes1
answer647
views -
2
votes1
answer111
viewsA: crt*. or C files
crt*.o are the implementations of C Runtime, the set of functions that support basic C functionalities such as stubs which transform function calls to system calls in rags, the code that initializes…
-
0
votes1
answer1088
viewsA: How to read a variable of type unsigned char by the fscanf function?
If your compiler is running in C99 mode, the specifier you want is "%hhu": if (fscanf(entrada, "%hhu ", &elemento) < 1) { /* tratar erro de leitura, o arquivo provavelmente está corrompido */…
-
1
votes3
answers160
viewsA: Function prints while list
The for is a type of tie that is more convenient than the while, but this is the do while are more primitive than the first. As you can see, the for is composed of four "parts": for…
-
1
votes1
answer3508
viewsA: How to work with C Dates?
In C, there are no dates per se. The type that dates in C is actually a int that counts the number of seconds elapsed since 1 January 1970 UTC and the date in question. But to syntactically analyze…
-
0
votes1
answer137
viewsA: import and export file . txt FILE in C
First, you are reading the default input numbers (stdin), not from a.txt file. That’s exactly what you want to do? Second, what are you doing with count is very weird. Why you start at zero,…
-
2
votes3
answers944
viewsA: Return the Id of table 1 and insert in table 2 in the same code
Better than using @@IDENTITY is to use SCOPE_IDENTITY(), which returns the last value checked in a type column IDENTITY done in the current scope, that is, it was effectively inserted by the code…
-
2
votes1
answer352
viewsA: Could you add a parameter in: system("color", var) in the C language?
To system() does not receive parameters, but you can use the snprintf() to compose its string command: char buf[20]; snprintf(buf, sizeof(buf), "color %s", opccor); system(buf);…
-
0
votes1
answer114
viewsA: How to put score in a sql Row
You can create a function that writes the number to pieces, and insert the dots between them: void escrever_numero(unsigned int n, FILE * stream) { char buf[10]; char * ptr = buf; size_t nchar, i,…
-
0
votes2
answers81
viewsA: How do I pass this function to a php file called Geolocation via ajax?
Complementing the response of Pedro Augusto, but using the code snippet you posted, the easiest would be to do the post in function showPosition(), although in this case maybe she should change her…
-
1
votes2
answers7908
viewsA: How Binary Tree Removal Works in C
This is a binary tree that holds integers in intermediate nodes, in addition to leaves, and with the property that all numbers in the left subtree of a given node are strictly smaller than the…
-
2
votes3
answers4720
viewsA: Uncaught Typeerror: $(...). tooltip is not a Function
You have not included Bootstrap correctly on your page. For that, it needs a tag <script> within the tag <head>, sort of like this: <!DOCTYPE html> <html> <head>…
-
1
votes1
answer73
viewsA: Problem reading binary files!
I couldn’t get the code you wrote to run, as it needs other functions, as well as a preexisting "books.dat" file; but if records 3 onwards are being overwritten with record 2 information, the…
-
2
votes1
answer80
viewsA: How do I warn the compiler that this is an IEEE 754?
As you noticed, if you try to make one Typecast, the Runtime do C will try to perform the conversion as if the number was originally integer. What you need is the C equivalent of the…
-
1
votes1
answer99
viewsA: preecher array, struct in C?
If the values are fixed, you can use a structure literal: struct ledvalue numbers = { { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }, { 2, 5, 5, 4, 5, 6, 3, 7, 6, 6 } }; If they’re not, there’s no way loop, same;…
-
0
votes2
answers85
viewsA: How to get element id from find method?
The business is to automate as much as possible. In this case, a regular expression can extract the number from the previous line, increment it, and then generate a function that automatically…
-
2
votes1
answer147
viewsA: SELECT in multiple SQLITE tables
Just make a GROUP BY and MIN(): SELECT c.id, c.codigo_cliente, c.nome_cliente, MIN(v.data_visita) AS data_visita FROM CLIENTES c INNER JOIN VISITAS v ON c.codigo_cliente = v.codigo_cliente GROUP BY…
-
1
votes2
answers102
viewsA: Regex lookbehind
Regexjavascript s do not have support for lookbehind. Is there any reason why you can’t say /[IO]\d{3,13}(\w{12})/.exec(String1)[1]? After all, a regex with lookbehind is semantically equivalent to…
-
0
votes1
answer117
viewsA: Doubts in code C data structure
Where to start? First of all, avoid using global variables whenever possible. In particular, define a global int i to use as an index for loop is to get into infinite confusion, since you always…
-
0
votes2
answers137
viewsA: Adjust word inside the toggle
Alternatively, without using javascript to control behavior: HTML: <label class="toggle"> <input type="checkbox" id="onoff2"> <div></div> </label> CSS: /* .toggle é o…
-
0
votes1
answer1003
viewsA: How to create a child process to an existing process in windows - C/C++
Unfortunately, no. The CreateProcess() (as well as the fork() in Unix) create processes linked to the process that created them (for example, they report to it status output, it is from him that…
-
0
votes1
answer30
viewsA: ntddk. h and wdf.h... libraries can tell me their usefulness in this code?
<ntddk.h> is the header of NT Driver Development Kit, the development kit of drivers (Windows) NT. It defines various types of data needed to write drivers in a Windows NT4 environment or…
-
0
votes1
answer124
viewsA: update of lines followed according to items selected in listview
On the line cmd.Parameters.AddWithValue("@idSala", Convert.ToInt32(dgvSalas.CurrentRow.Cells["idSala"].Value.ToString())); Where do you update dgvSalas.CurrentRow? 'Cause it looks to me like you’re…
-
0
votes3
answers871
viewsA: Polymorphism in C
Simple C inheritance can be simulated very easily. However, this depends on making type coertions (typecasts), which prevents you from using the type system to catch some bugs simple. Let’s take an…
-
1
votes3
answers1198
viewsA: Block event click element
The simplest way I can see is simply, in the event processor, check if the click was in the email field and only hide in this case: jQuery(document).on('click', '#black-curtain', function (e) { if…
-
5
votes2
answers128
viewsA: Use of conditions in matrices
Actually you need four somalin and four somacol, one for each row/column in valores. So once you popular the matrix, you will make a for double to address each element and increment the sum of the…