Questions tagged as 'c'

1
answer

Auto benchmarking with moon

A script in C or C ++ could write algorithms on Lua (by brute force , that is, test several possible combinations) based on a database with algorithm results. The idea is to arrive at the most efficient algorithm for a given goal, for exampl...
asked by 02.07.2014 / 00:27
2
answers

cho-han bakuchi in Basic C

I'm having a question in the program I made to represent the game cho-han bakuchi, this game has as a rule to roll two 6-sided dice in a cup before showing the dice if the bet is made in which the player speaks cho pairs) or han (odd) and then t...
asked by 11.07.2014 / 16:44
1
answer

Why can I only handle files with pointer?

In the statement I always have to put FILE *Arq; If I put it without * it gives an error. What is the reason?     
asked by 20.09.2018 / 21:24
2
answers

Doubts if else returning 0

I'm trying to do the following exercise:    10) A fruit bowl is selling fruits with the following price list: Até 5 Kg Acima de 5 Kg Morango R$ 2,50 por Kg R$ 2,20 por Kg Maçã R$ 1,80 por Kg R$ 1,50 por Kg       If the cust...
asked by 03.09.2018 / 01:07
2
answers

How does the compiler work in the case of a casting like this?

Having the following code: 0 #include<stdio.h> 1 2 int 3 main(void) 4 { 5 int x; 6 x = -3; 7 8 for (int i = 0; i < 5; i++) 9 { 10 printf("%d\n", (unsigned int) (x - i)); //n...
asked by 31.08.2014 / 02:43
1
answer

Conversion from decimal to binary [duplicate]

Would there be a way to solve this problem using only repetition, div and mod, without using vector or a specific function for conversion?     
asked by 29.05.2018 / 20:25
1
answer

Take number by number of a sequence of numbers to compare them

My teacher of algorithms and programming techniques spent an exercise in which a = "123567348" and of that I would say which numbers are even and which are prime. He said he would have to use substr() , and passed an example: #inc...
asked by 15.10.2018 / 22:57
2
answers

Sum of n + last digit from left

I'm having a recursion challenge. The goal is to return "n + the sum of the last digit to the left". Example: Entry: 54321 Output: 54326 (54321 + 5) But the only way I got it was like this: #include <stdio.h> int somault(int n)...
asked by 05.11.2018 / 00:50
1
answer

Highest value in a fixed vector of 10 positions

I am with pending exercise to find the largest element in a fixed vector of 10 elements. But when I declare the integer of the vector works, but when I ask the user to enter the values it does not work. int i, v[10]; int maior = v[0]; for(i =...
asked by 21.10.2018 / 22:06
1
answer

Partitioning the algorithm into functions

The problem is as follows:    A function receives an int as a parameter, and returns it written to the contrary and another to test if the input number and the inverted number is palindrome. I was able to solve the problem of identifying...
asked by 31.10.2018 / 02:56