Posts by João • 109 points
10 posts
-
0
votes1
answer177
viewsQ: Discover Winner Game Rooster / Old Game
I am developing the game of the rooster / old game and in this game I have to check every new move or iteration if there is any winner. I started by trying to do this for a static matrix predefined…
-
2
votes1
answer395
viewsQ: Calculate Factorial Array using Thread’s
I’m having problems in the following exercise Write a program that, given a vector with the first 5 numbers primes, pitch 5 threads. Each of them will calculate the value of the factorial of one of…
-
0
votes1
answer132
viewsQ: Preorder Iterative - Binary Search Tree
I have a function that runs through BST (Binary search Tree) recursive pre-order. The function is the following: public Iterable<Key> preOrder() { Queue<Key> queue = new…
-
0
votes1
answer35
viewsQ: Call to the system dup2 vs. write&read
I have a doubt in understanding why in some cases there are examples of conversations in the parent process and the child process - obtained through the call to the Fork system ( ) - which use read…
-
1
votes1
answer66
viewsQ: Program without SIGINT signal interruption
I’m trying to write a program that stays on an infinite loop, and can’t be stopped by the SIGINT( C signal on the keyboard). What I have so far is the following code: void sigint(); int main() { int…
-
1
votes1
answer50
viewsQ: Reading txt file for memory
I’m trying to read the file that contains only 3 elements. Username: User X Sex of user: Male or female User age: X age The code I have at the moment is as follows:: FILE* fp; char linha[500]; fp =…
-
2
votes1
answer181
viewsQ: Order Growth
Needed help to figure out the correct calculation of the order of growth of this code snippet (function of N=2 M) int sum=0; for (int i = 0; i < = N; i++) for(j = 1; j <= N; j++) for(k = 1; k…
-
2
votes1
answer300
viewsQ: Break text and vector store
I want the program to be able to store only one sentence per line. Each sentence is possible to be completed according to the signals I show in my code example. It does this but when printing on the…
-
0
votes2
answers349
viewsQ: Dynamic matrix creation that stores broken text
Attempt to create a dynamic matrix using malloc(). I am in doubt if the parameters I send to the different cycles of the function will be right. int size=0,i,j,n=20; char str[]="Ola. Tudo bem?\n Sim…
-
1
votes1
answer1554
viewsQ: Delete repeated words in a string
Given a string, I need to check which are the non-repeated words (or ones that appear only once) and pass those same words to a new string in order to be able to store that information. I tried to…