Questions tagged as 'c'

1
answer

How would the conversion of this algorithm from C to Python

unsigned char CheckSum(unsigned char *uBuff, unsigned char uBuffLen){ unsigned char i, uSum=0; for(i=0; i < uBuffLen; i++){ uSum = uSum + uBuff[i]; } uSum = (~uSum) + 1; return uSum; }     
asked by 07.09.2017 / 14:59
2
answers

Pass pointer as argument to a function

I want to create an array using pointer pointers, however I'm having a hard time passing the parameters. First I dynamically allocate the array using a function. And then I read it. The program compiled, however at the time of reading the values...
asked by 06.09.2017 / 22:48
1
answer

I can not use accents in Code Blocks

Hello! I have a code: include stdio.h> include locale.h> int main() { setlocale(LC_ALL,"portuguese"); printf("Agora não tem mais problema algum para utilizar acentuação!\n"); return 0; } Configured right ... But it does not return w...
asked by 15.09.2017 / 01:39
1
answer

Improvement and simplification of the code

I'm in the first semester of college, and as a final project the teacher asked me to do a hangman game, I already did my code but wanted them to suggest improvements or report future code problems. #include<stdio.h> #include<locale.h&...
asked by 10.11.2017 / 18:04
1
answer

Division does not generate the expected result

When I do the split of mul / total_filhos_mul the variable mul is zeroed, if I do not do this division it gets the correct value. What could be happening? #include <stdio.h> int main(){ int hab,i=0,hom=0,mul,sal_men...
asked by 09.11.2017 / 16:31
1
answer

Bugs in algorithm that encrypts text

I am writing an algorithm that encrypts text using a password word, Vigenère cipher. Upper and lower case characters should be encrypted, special characters, and numbers should be ignored. My questions: When you run the program, enter the pa...
asked by 19.09.2017 / 01:02
2
answers

File reading

I need to read from a file the number of tests to be done and which tests to run. The input file is as follows: 4 //Numero de testes a serem feitos 1 LINSIMP 3 //Primeiro(1) teste que verifica se a linha 3 é simples 2 LINPOL 3 1 //...
asked by 01.07.2017 / 23:46
2
answers

Point inside a polygon

I need to create a function that checks whether a point is inside a polygon. For that, I researched the internet some solutions that could help me. I found one that seems to be of great help, but in one of the functions needed to run the main fu...
asked by 27.06.2017 / 17:28
2
answers

How do I round a float number from two decimal places to one if I have only one number? example: 2.10 to 2.1

The problem is that numbers must always have two decimal places, only in cases where '3.10' has to be formatted to '3.1'. How do I do this in C?     
asked by 27.06.2017 / 18:09
2
answers

Data Comparison in Files [C]

I want to make an algorithm that takes a name in an X file and see if this name exists in another file Y, if it does not exist it writes that name to a third Z file. (Basically an algorithm that points the missing ones in a attendance list). I t...
asked by 18.08.2017 / 05:33