Questions tagged as 'c'

1
answer

Errors: division by zero and iterator not dereferencable

I'm having trouble compiling this code, it returns me two errors when I run it: vector<bool> cp( size ); // determine crossover point (randomly) for( int i = _numberOfCrossoverPoints; i > 0; i-- ) { while( 1 ) { int p...
asked by 07.11.2018 / 03:33
1
answer

invalid operands to binary% (have 'float' and 'int') [closed]

When compiling the code I get the error in the title of the question for the line res100=notas%100; How to solve? Code: float notas,N100,M1,M050,M025,M010,M005,M001,res100,res2,res1,res05,res025,res010,res005,res001,N50,N20,...
asked by 15.10.2018 / 23:55
1
answer

Compile error when registering information in a struct and a substruct

I have a problem with my C code. My goal is to register categories in my first struct, which happens without problems. Then I want to register some subcategories for each category, which causes the following problem in the code: main.c|45|erro...
asked by 30.12.2018 / 01:32
1
answer

C program compiles but output error

#include <stdio.h> #include <stdlib.h> #include <locale.h> float bonus_a_receber(float salario, float perc){ float a_pagar; a_pagar = (salario * perc) / 100; return a_pagar; } int main(int argc, const char * argv[]...
asked by 25.09.2018 / 07:31
1
answer

Type error in the return of a derivative function [closed]

I have the following code in C, I'm compiling it in linux using gcc and -lm (below) What happens is: f (x + dx) - f (x) gives zero (which is not!) The functions f (x + dx) and f (x) are being calculated right, a print to see and the difference...
asked by 20.04.2016 / 22:39
1
answer

Error reading string to file

Well I'm reading a file with the formatting of type: name.txt names columns columns types Where I can read all these strings, but when printing them, for example in a line with two column names and their respective two types, printf only s...
asked by 14.11.2018 / 03:19
1
answer

passing by struct reference does not work (dynamic queue C)

I'm trying to implement a Dynamic Queue. When I initialize the program (start and end = NULL), and then put to queue a value (function queue) the "end" pointer receives the new queue item, however the "start" does not, whereas in the function I...
asked by 13.11.2018 / 04:01
1
answer

How do I return the number of items in a stack

****** I did this Exercise, but in the element count of the stack, the value of items is not appearing. Could you help me please **** #include <stdio.h> #include <stdlib.h> /* Um elemento da Pilha tem a chave, (e outros campos se...
asked by 04.07.2018 / 22:00
1
answer

I can not do these steps! I wanted help

(b) Find the student with the highest grade in the first test. (c) Find the student with the highest overall average. (d) Find the student with the lowest overall average. #define MAX 50 struct { int ra; char nome[MAX]; float...
asked by 17.06.2018 / 04:41
2
answers

Does my program only execute the first if?

I need to work out an algorithm that receives 3 real values and checks whether these values can be the lengths of the sides of a triangle, and in this case, return the type of triangle formed. So that x , y and z form a tr...
asked by 27.05.2018 / 05:26