Questions tagged as 'c'

1
answer

Program does not execute when filling vector with random numbers not repeated in C

I'm trying to get the random numbers to be generated and fill a vector in a separate function, but the program does not execute and hangs if I put a high, and not as high, number as 50 or 100. Below is my code , if anyone knows what's wrong help...
asked by 28.03.2017 / 12:50
2
answers

Largest number function in a tree

I'm developing a function to return the largest number of a tree. I'm trying this code, but I did not succeed in compiling it, printing -1 on the screen, while it was only to print the largest number of the tree. int maiorNum(tipo_arvor...
asked by 23.05.2017 / 14:01
1
answer

Doubt Nesting Structs

I need to make a product registration program and include these products in a shopping cart and end the sale. Before I had already done a program that registered the products, which contained only the struct Product: So: struct Produto{...
asked by 04.12.2016 / 17:26
1
answer

Why is it giving an infinite loop?

   Exercise: Write an algorithm to generate and write a table with   s values of an angle A in radians, using the series of   Mac-Laurin truncated, presented below:       A3   A5   A7   sin A = A-6 + 120-5040       Conditions: Angle A value...
asked by 14.04.2017 / 02:51
1
answer

Pass vector as argument to a [closed]

I'm trying to pass a vector to a function in C, but I do not know what I'm doing wrong. As the code is small, I'll post the entire one: #include <stdio.h> int calcula(double A){ if(A<=10.0){ resposta = A; } re...
asked by 26.02.2018 / 19:06
2
answers

Exercise in C, change printing

Consider four coins, 25 cents, 10, 5, and 1. Construct a C program that asks the user how much he wants to get back, and then prints out the amount of coins needed to pay the change, number of coins. The program should have a loop that forces th...
asked by 14.08.2017 / 20:03
2
answers

Scan more than one string

In C can I scan more than one string as it does with integers? Type: scanf("%s %s", pal1, pal2);     
asked by 18.09.2017 / 13:27
1
answer

Help with pointers

Can anyone help me with this code? it is not working, I can not find the error. #include <stdio.h> int chamar(int *n){ printf("Digite o valor de n:"); scanf("%d",&n); printf("%d",n); return 0;...
asked by 13.04.2016 / 04:31
3
answers

Count numbers 1 in binary number after decimal base conversion

In this program I need to count the number of 1's present in the binary number after converting the decimal base. Here is the code: #include<stdio.h> #include<stdlib.h> #include<string.h> int main () { char valor[1000]...
asked by 12.09.2016 / 19:46
1
answer

Error using pow (a, b)

#include <stdio.h> #include<math.h> int main() { double pi = 3.14159; double R, A; scanf("%lf", &R); A = (pi)* pow(double R, int 2); printf("%lf\n", A); return 0; } This code is returning the error: Too few arguments to fu...
asked by 10.01.2017 / 04:41