Posts by Maurício Z.B • 1,098 points
51 posts
-
3
votes1
answer47
viewsQ: Cross-Reference with pointer array
I’m creating a cross Reset of a pointer vector that calls a simple chained list. Goal is to type a sentence and decompose your words, placing them in each vector position according to their…
-
1
votes2
answers62
viewsA: C - Remove result element
I was going through your code and I realized that you had a question list the houses after the , how to eliminate them. So I tested this code and it worked: #include <stdio.h> #include…
canswered Maurício Z.B 1,098 -
0
votes1
answer134
viewsA: Why is this kind of comparison/choice wrong?
For your program to work this way it has to be by conditional structure se: escreval("Digite o consumo") leia(consumo) se consumo <= 100 e consumo>=0 entao escreval("Parabéns, voce e…
-
0
votes1
answer160
viewsA: How to save and read a saved array from the directory in Scilab?
An example of how to make the load function work is like this: a=eye(2,2); b=ones(a); save('vals.dat',a,b); clear a clear b load('vals.dat','a','b'); disp(a); disp(b); //to read the matrix…
scilabanswered Maurício Z.B 1,098 -
0
votes2
answers157
viewsA: Sum of numbers from right to left
Assuming that this input number can be from 0 to several decimal places. The logic to solve the problem would be to individually divide the number by 10 until 0; So the code can go like this:…
-
0
votes3
answers459
viewsA: Store values in matrices
Codeblocks is a development environment in which it has compatibility for multiple compilers. Evaluating your code: #include <stdio.h> #include <strings.h> #include <stdlib.h>…
-
0
votes3
answers409
viewsA: Sex selector on if parole
First of all if(sex == m) { printf(" bem vindo Senhor %s\n", nome); // se for homem } This comparison mode is wrong. Because the sex variable is a char vector, or rather, string as you want to call…
-
0
votes0
answers112
viewsQ: Integral of polynomials in Scilab
How to discover the integral of a polynomial expression in Scilab ? I have that code: clc; clear; x=poly(0,"x"); printf("Digite a expressão para calcular:"); mfun=input(""); printf("MENU DE…
scilabasked Maurício Z.B 1,098 -
0
votes0
answers45
viewsQ: How to extract a word between , and =?
Supposing I had a word: char[1000]={"ALGUMA COISA,ALGO=TESTE,FIM"}; The word before = and = itself are optional in the sentence; How do I store the SOMETHING word of the phrase in a variable? The…
-
1
votes0
answers56
viewsQ: Problems when deleting an element from a list within another chained list
I’m having a problem removing an element, I have a function that is responsible to delete the element within double-chained lists. How it works? In the main function is called the name of an…
-
5
votes4
answers2189
viewsA: Sum of primes in a range in C
I was looking at your code: #include <stdio.h> int main() { int numI, numF, primos = 0; scanf("%d %d", &numI, &numF); int i; for(i = 0 ;numI <= numF; i++){ if((numI%2 == 0)…
-
1
votes1
answer1349
viewsA: Doubt in reading Matrix per file in C
Your code is missing one \n (means "new line", ie "new line") in case it would look like this printf("\n"); after the first is. It will run the code knowing that Lin is 48 and Col is 2 it will run…
canswered Maurício Z.B 1,098 -
-1
votes2
answers100
viewsA: String compilation problem in C
#include<stdio.h> #include<string.h> #define tam 100 typedef struct TipoAluno{ char *nome; char *curso; char *cota; int matricula; int coef; }TipoAluno; void GeraArquivo(FILE *arq,…
-
2
votes1
answer692
viewsA: Read Java Integer Number
You can do it like this: import java.util.Scanner; public static void main(String[] args) { Scanner entrada = new Scanner(System.in); int a,b; System.out.println("A :"); a=entrada.nextInt;…
-
0
votes2
answers74
viewsA: exclude people names from a C array
1º Create an auxiliary char variable; 2º You must take the index that enters the parameter in the function and go through the array of the , until the , corresponding; (If there are numerous "," it…
canswered Maurício Z.B 1,098 -
1
votes3
answers59
viewsA: How to create a function that divides two numbers into C?
More briefly it is so: float dividir(float a, float b) { float c=a/b; return c; } This way I put function float in the case will return a float to main. There is only you do the assignment... type…
-
-1
votes2
answers95
viewsA: Function to read file in C
To read the file you can use the fgets : #define N 10000 [...] FILE *arquivo; arquivo=fopen("lugar.txt","r"); if(arquivo == NULL) printf("Erro, nao foi possivel abrir o arquivo\n"); else{ while…
-
0
votes1
answer76
viewsA: Null list error
Solution: In the case 0 and in the case 1 which are within the case 3 were being inserted the data in the same list and finally releasing. (Both in 0 and in 1) I used two different lists and two…
-
0
votes1
answer76
viewsQ: Null list error
Guys I’m having a problem, my code is running right option 3 only the first time if return to the menu and try again it appears nulla. O case 3 is to list names in alphabetical and reverse…
-
1
votes0
answers177
viewsQ: Code Issues in C Chained List
I’m having a problem with a C code. I’m trying to open a txt file that has movie name, year , actor,... And I’m putting the movies on a chained list. The problem is at the time of sorting the movies…
-
1
votes3
answers7818
viewsA: Read multiple scanf numbers separated by space
If I understand correctly you are trying to read numbers and insert in a vector, being that these trying to make this reading with more than one number... Follow the example: #include<stdio.h>…
-
1
votes1
answer2329
viewsA: Sort a student list by name in alphabetical order
Tried using the strcmp() function of the string library. h ? The function strcmp() takes two string to be compared to each other. The result can have 3 possible returns: Less than 0: Character of…
canswered Maurício Z.B 1,098 -
0
votes1
answer114
viewsQ: General game in Java
Good afternoon guys, I’m doing the General’s game (java dice). I am in doubt on how to compare the data between them. Sequel Possible sequences: 1-2-3-4-5 / 2-3-4-5-6 / 3-4-5-6-1 Number of points:…
-
1
votes2
answers139
viewsQ: Code problem in Java
I am doing a program in basic Java. At the moment there are 6 classes, however, you are having problems in 2 classes at the time of registration. I’m making a SET to register the name of the player…
-
2
votes1
answer214
viewsQ: How to delete a node in a chained list in Java?
I have the following java code but it’s not working properly. I need to delete a node from a chained list. Someone help me? /* Delete Node at a given position in a linked list head pointer input…
-
0
votes1
answer656
viewsQ: Convert recursive to iterative function
I have a chained list merge function working. However, recursion is being used and I would like to change the code and iterate. But I was unsuccessful. Follows the code: struct Node { int data;…
-
0
votes2
answers1770
viewsA: How to scroll through a chained list from the last position?
Guys I got!!! The code went like this: int GetNode(struct Node *head, int positionFromTail) { int x = 0, y = 2; struct Node *fimNodo = head; if (fimNodo == NULL) { return -1; } while (fimNodo !=…
-
0
votes2
answers1770
viewsQ: How to scroll through a chained list from the last position?
I have a question about a chained list in C. The exercise is a function that takes as parameter the initial node of the chained list and the position x (counting backwards). With this, I have to go…
-
0
votes2
answers1519
viewsQ: How to compare two chained lists in C?
Guys, I have a problem with this issue: -I have to compare two chained lists and return 1 if they are equal or 0 if they are not. The function is like this and I can’t progress: struct Node { int…
-
1
votes2
answers608
viewsA: Can anyone help me with this?
Hello was viewing your code and the logic is correct, however, you forgot that the "&" is only used for scanf and not for printf (if you use for print will take the address of the memory and not…
-
0
votes4
answers604
viewsA: Return only positive results
Hello try to do so (need to compare which is the biggest before making a difference): algoritmo "exercicios" var time1,time2,dife:inteiro inicio escreva("quantos gols do time A? ") leia(time1)…
-
1
votes2
answers242
viewsA: Different views of the same variable in C Language
To better understand You remember the scanf("%d",&whole); ? scanf(); is read command; %d (or %i) is to represent whole decimals; & is to represent the address; Logo scanf("%d",&integer);…
-
0
votes1
answer332
viewsQ: How do you find out if the list is full?
The method below is to include a book in a list. Returns 1 if the book already exists in the list, 0 if it does not exist in the list and can be inserted and 2 would be for full list. I’m trying to…
-
3
votes1
answer783
viewsA: Exit a c program via CMD
case 9: break; So I’m out... or you can use the remote: system("exit");
-
7
votes1
answer63630
viewsA: What is the function of getch(); and conio. h library?
The getch() as well as the getche() returns the typed key, widely used in menus with switch. (Difference between the two is that the getch() does not show the key you typed on the screen, already…
canswered Maurício Z.B 1,098 -
1
votes2
answers1673
viewsA: Error in program in Visualg
Try it this way: inicio n <- 0 i <- 0 escreval ("Digite 15 idades: ") para i de 1 ate 15 faca leia (n) se (n < 18) entao escreval ("Sua idade corresponde a classificação: criança") fimse se…
-
1
votes2
answers282
viewsA: How to execute a function in ajax when opening the page?
Try it this way: $.ajax({ type: "POST", url: "tra.php", data: {}, dataType: 'json', success: function(Last) { line.originalData[0].push(Last); line.originalData[0].shift(); RGraph.SVG.redraw();…
-
2
votes5
answers8920
viewsA: What is the difference between Visualg and Portugol?
The VisuAlg is a program that edits and executes algorithms with a language close to structured Portuguese as if it were a normal computer program. The Portugol is a pseudo-language that has been…
-
0
votes2
answers760
viewsA: How to solve this "Error in syntax"
Your code: algoritmo "Duração de Evento" var segundos, sec, horas, minutos : real inicio escreva("Quantos segundos o Evento dura?") leia(segundos) horas<-segundos/3600…
portugolanswered Maurício Z.B 1,098 -
-1
votes1
answer89
viewsQ: Do While is not working properly
Do while is not working in the code. At first the test that I am doing now is only the first of the menu (register the user) and then should go back to the menu until S is typed. (It is running only…
-
0
votes2
answers447
viewsA: Limit, or capacity of a Vector
Create a loop with while(with counter of course) and at the end of the loop add an if condition(if it is the final position)...and give the warning with printf();
-
2
votes2
answers5747
viewsA: Display whether a person is of legal age or not
You can do it like this: algoritmo"exercicio" var idade: inteiro inicio // Seção de Comandos, procedimento, funções, operadores, etc... escreva ("Digite sua idade: ") leia (idade)…
-
3
votes1
answer4196
viewsA: How to save data in. txt file in Visualg?
There is the possibility to save data to a file in . txt in Visualg! Visualg allows data to be stored in a text file, obtaining data from it when executing the commands leia. This feature works as…
-
0
votes1
answer69
viewsQ: Problem when registering user in the list
I’m trying to register users and put them on the list. Initially I just tried to register and test with print. (Still indicates errors) Does anyone know why it’s not working? The mistakes are:…
javaasked Maurício Z.B 1,098 -
4
votes2
answers1903
viewsQ: How to convert Lowercase String to UPPERCASE?
My question is in switch (opcao). To perform one of the cases it is necessary to enter with capital letters. Is there any string or Java character conversion function from lowercase to uppercase…
-
2
votes3
answers2734
viewsA: How to use the REPEAT command in this algorithm?
It may be so... var menor,idade,maior,contador:inteiro idade_media:real inicio menor <- 999 contador<-1 repita escreva ("Idade: ") leia(idade) idade_media <- idade_media + idade se (idade…
portugolanswered Maurício Z.B 1,098 -
1
votes1
answer912
viewsA: Return to menu
Well first the syntax at the end is missing one fimescolha. Try to see the example below and add to the code repeat it so you can go back to the menu to select another option. Inicio escreval("…
portugolanswered Maurício Z.B 1,098 -
1
votes1
answer485
viewsA: Vector issue portugol
If you want to see the amount of repeated numbers, you will need to make a variable cont. To store the repeated numbers you can make an extra vector and store them there. That part: se vet[j] <…
portugolanswered Maurício Z.B 1,098 -
0
votes2
answers3245
viewsA: What are genetic algorithms?
A genetic algorithm (AG) is a search technique used to find approximate solutions to optimization and search problems. (using techniques inspired by evolutionary biology as heredity, mutation,…
-
4
votes1
answer146
viewsQ: Problems with Assembly
I recently started studying computer architecture in which it is necessary to know this language. Because it is an assembly language (low level language), I did not find any IDE so I could test the…
assemblyasked Maurício Z.B 1,098