Posts by André • 562 points
38 posts
-
0
votes1
answer122
viewsQ: Exercise Palindromo Javascript
I would like to understand this code as simplistically as possible. var palindromo = ""; for(var i = palavra.length - 1; i >= 0; i--) { palindromo += palavra[i] } if (palavra == palindromo) {…
javascriptasked André 562 -
2
votes3
answers649
viewsQ: Binary tree removal
Personal as the tree looks after the removal of the number 40? In my understanding, instead of 40 would be number 41, right 44 and left 30. And the right of the 44 the number 49, to right?…
-
0
votes0
answers298
viewsQ: Understanding the Quick Sort algorithm graphically
I have this code below working correctly. #include <stdio.h> #include <stdlib.h> #include <string.h> void quicksort (int *vetor, int inicio, int fim) { int i, j, meio, aux; i =…
-
1
votes2
answers299
viewsQ: Inserting elements in a dynamic list
I did this function, but I do not know if it is right, there is no error in the compilation, but it gives an error when the prompt that the program has stopped working. Insertion at the beginning:…
-
1
votes1
answer438
viewsQ: Print on dynamic list screen
Staff can not perform the function of printing on the screen, could help me in this function below. void imprime_lista(Lista* li){ while (li != NULL) { printf("%d ", li -> struct amatricula); li…
-
3
votes3
answers5096
viewsQ: Centralize printf
Personal how do I center messages, simple texts? printf("CLÍNICA DE ANÁLISES LABORATORIAIS\n\n"); printf("TRIAGEM ADMINISTRATIVA\n\n"); These two lines above are within the main. I’d like to center…
-
0
votes1
answer127
viewsQ: Description of a declaration by reference
I have a question in making descriptive comment related to the parameters of these 3 functions below. int proximoClientePreferencial(CLIENTE *filaPreferencial){ void mostrarFilaPreferencial(CLIENTE…
-
2
votes1
answer142
viewsQ: Data Structures - List Differences
Please would like to know the real difference between these structures below: typedef struct { int info; struct lista * prox struct lista * ant; } tipo_lista; and that: struct noCliente { int…
-
1
votes2
answers57
viewsA: Selected language error
I put this statement and the error is gone. #include <clocale> Agree?
-
1
votes2
answers57
viewsQ: Selected language error
I copied a source code made in the program Code Blocks and pasted it in a project in Visual Studio C 2010 Express, compiled and is giving some errors, one of the errors is in this line: int main(){…
-
1
votes1
answer59
viewsQ: Trash memory output function inserts in the middle of a list
Staff developed this function: tipo_lista * insere_meio(tipo_lista *aux, tipo_lista * valor, int pos){ int cont=1; //é a posição do primeiro elemento da lista encadeada tipo_lista * p = aux;…
-
-1
votes1
answer1321
viewsQ: Inserting in circular list
I am having doubts in this code of the function of inserting circular list. tipo_lista * inserir_inicio (tipo_lista * p, tipo_lista * novo_no) { //Se a lista estiver vazia if(p==NULL) return…
-
-1
votes2
answers3403
viewsQ: Largest number function in a tree
I’m developing a function of returning myself the largest number of a tree. I am trying this code, but I did not succeed in its compilation, printing -1 on the screen, while it was to print only the…
-
1
votes1
answer68
viewsQ: Function insert in list
Hello. I am developing this function below: void inserir_inicio (tipo_lista * p, tipo_lista * novo_no) { novo_no -> prox = p; p = novo_no; } And in the main I’m calling for:…
-
0
votes2
answers89
viewsQ: Difference in calls on main
Guys, I want to know the difference between these two calls? inserir_inicio(&p, cria_no(0)); p = inserir_fim(p, cria_no(0)); When I try to switch to the style of the first call the code compiles…
-
0
votes1
answer842
viewsQ: Function print circular list
Personal I am with a doubt of where and how I should change to this function of printing circular list get correct. Below is a print function from a linked list: void imprime_lista(tipo_lista* p) {…
-
1
votes1
answer115
viewsQ: Function count left tree
This function below compiles correctly, works. int qtd_niveis (tipo_arvore * raiz) { if (raiz == NULL) return 0; int esquerda = qtd_niveis(raiz -> esq); int direita = qtd_niveis(raiz -> dir);…
-
0
votes2
answers2122
viewsQ: Lock letters and special characters
Good afternoon. I am developing a program in C and have to deal with when the user type letters or special characters. It turns out that when I test by typing a letter, the program loops, kind of…
-
1
votes1
answer327
viewsQ: Function remove Start List
I am with this function to remove at the beginning, it happens that when I insert numbers as for example: 1 2 3, and then call the function to remove at the beginning and delete the number 2, while…
-
0
votes0
answers77
viewsQ: Number function in the List
People have that function tem_numero_na_lista it turns out that it is printing on the screen only the last value I entered in the list. The effect I want is to print out whether or not you have…
-
0
votes1
answer108
viewsQ: Linked list main help
I’m having trouble creating a main so test if my functions are correct. is a list program on, no need to have menu. #include <stdio.h> #include <stdlib.h> #include <stddef.h>…
-
0
votes2
answers71
viewsQ: Insert linked list node
I have this function of inserting at the beginning, but I’m not being able to test it. Follows: void inserir_inicio (tipo_lista * p, tipo_lista * novo_no) { novo_no -> prox = p; p = novo_no; } I…
-
-2
votes1
answer76
viewsQ: Insert end list function on
Guys I’m not getting to develop this function. bool inserir_fim (tipo_lista * p, tipo_lista * novo_no) { }
-
2
votes2
answers153
viewsQ: Print number of nodes in a list
This code below does not work properly, I type 5 knots and was to return the number 5 (total amount of knots entered). It happens that returns me 4. int qtd_no_lista (tipo_lista * recebida) {…
-
2
votes3
answers160
viewsQ: Function prints while list
How do I do this function with the loop while? void imprime(lista* recebida){ lista* aux; for(aux=recebida; aux!=NULL; aux=aux->prox){ printf("Informacao %d\n",aux->info); } }…
-
4
votes2
answers1567
viewsQ: Error declaration null - Unknown type name bool
The error you are making is in this function. bool tem_numero_na_lista(tipo_lista * aux, int valor) { while (aux - > prox != NULL) { if (aux - > info == valor) { return true; } aux = aux -…
-
2
votes1
answer776
viewsQ: Total number of elements in a stack
I want to know how to return on the screen the total number of elements in a stack. For example: I have an array stack of size 10 and stacked 6 elements in it, will have to return me the total of 6…
-
0
votes1
answer400
viewsQ: Function First element Stack
How do I make a function that returns the first element inserted of a pile? For example: i add whole values to my size 5 vector stack. 3 4 5 6 7 You have to return the first element inserted in the…
-
0
votes1
answer1075
viewsQ: Insert Row C element
How do I "Insert an element (returning 1 if the insertion has been successful, and -1 otherwise) in a Queue" I did it, what’s missing: void enfilerar(tipo_fila *fila, int valor) { if…
-
1
votes0
answers453
viewsQ: Row function in C
Guys, I have to do a de-rank function. Receive from the user: -1 to un-row an element or 2 to queue an element That is to say the user to queue has to type option 2 and then enter the values and go…
-
1
votes1
answer168
viewsQ: Stack does not work properly in Codeblocks
This code below compiles both in Codeblocks and Visual Studio, but the output is different in Codeblocks. By VS I do not delete anything from the code below, just run and ready, now in Codeblocks I…
-
-1
votes2
answers515
viewsQ: Even stack and odd stack logic error
Guys I got this code down, it works, only it’s weird, it doesn’t print the last position. #include <stdio.h> #include <stdlib.h> #define TAM_PILHA 2 #define NUM_ENTRA 5 void empilha(int…
-
2
votes1
answer800
viewsQ: stdafx. h library error
Does anyone know why there’s a mistake in this library and how to fix it? This is stated in the codeblocks header: #include "stdafx.h" #include <windows.h> #define TAM_PILHA 2 #define…
-
1
votes1
answer3323
viewsQ: Code stack and pop a stack
People I’m testing this code in codeblocks and it’s giving a very weird result, saying that the stack is empty and I can’t see where the error is. void empilha (int *p[], int *topo, int valor){ if…
-
1
votes2
answers325
viewsQ: How to test the factorial in Main()?
How would the main() of this function below? The user enters a number and appears on the screen the factorial of the same. int fatorial(int num) { if (num >= 0) { int fat = 1; while (num > 0)…
-
3
votes2
answers3951
viewsQ: Factorial function in C does not return the result
What’s wrong with my code? int fatorial (int n, int num, int fat) { if(num >= 0) { fat = 1; n = num; while(n > 0) { fat *= n; //FATORIAL = FATORIAL*N n--; } } }…
-
0
votes2
answers43
viewsA: Error logout cookie Servlet
I managed to fix, my current code is like this: public class Logout extends HttpServlet { protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException…
-
1
votes2
answers43
viewsQ: Error logout cookie Servlet
Hello. I have a line error: Cookie cookie = new Cookies(req.getCookies().getUsuarioLogado(); The complete method/class is this: @WebServlet(urlPatterns = "/logout") public class Logout extends…