Questions tagged as 'c'

1
answer

Delete repeated words in a string

Given a string, I need to check which words are not repeated (or those that come up only once) and pass those same words to a new string in order to save that information. I tried to implement a function that did this but it did not work, and...
asked by 08.11.2017 / 14:54
2
answers

Numbers in Ascending Order C

I'm trying to make a code to show 3 random numbers in ascending order typed by the user however I do not understand why my code is not working #include <stdio.h> main(){ int numeros[3],a,b,c,maior=0,menor=0,medio=0; printf("Digite 3...
asked by 17.03.2017 / 21:01
1
answer

How to transform an array of floats to integer array? [closed]

How do I convert an array of floats to an array of integers? Ex: float grade{12.30, 15.55, 16.25, 0.00, 3.68} Output: {12, 15, 16, 0, 3}     
asked by 07.10.2017 / 16:44
1
answer

Why use a pointer in this algorithm?

When I retreat the code does not work. Why? And why is the insert emulation algorithm algorithm only suitable for list of small entries, type array and list / p> void insert_sort(int *vetor, int TAM){ int i, j, aux; for(i = 1...
asked by 15.11.2017 / 18:49
1
answer

Tie for text file reading reads the last line twice

I'm doing a test to read a simple txt file with three numbers: 1 2 3 #include <stdio.h> #include <stdlib.h> int main() { int conta; FILE* arq = fopen("dicionario.txt", "r"); if(arq!=NULL){ while(!feof(arq)){...
asked by 17.01.2018 / 01:33
2
answers

Number draw with exception

How do I sort a% number of% numbers in the C language in which I can exclude the possibility of drawing a certain number from my range given a given condition? Exemplifying in code: #include <stdio.h> #include <time.h> #include...
asked by 16.11.2016 / 17:11
1
answer

How to create multiple .txt files?

How do I create multiple .txt files in c / c ++? I have this function: tocopy(){ FILE *file = fopen("Teste.txt", "w"); fclose(file); } But it only creates a test.txt file     
asked by 30.09.2016 / 06:05
1
answer

Array initialization error

I'm not understanding this error in the array. #include<stdio.h> #include<stdlib.h> #include<math.h> #define MAX 800 int main () { float ponto[MAX][MAX]; float i, j, n, y, x, aux_st, aux_s; y = x = aux_st = au...
asked by 21.09.2016 / 16:09
1
answer

How do data types work after const in C?

I'm reading some code and I came across the following code #define foo unsigned int #define i typedef I know how this unsigned and signed, typedef etc works, but I can not figure out how this works on the constant.     
asked by 19.09.2016 / 21:07
1
answer

Parallelizing n queens problem with OpenMP

I'm having trouble paralleling my C code with OpenMP and getting good performance on the n queens problem. The results are always considerably slower with parallelization enabled and I do not know why. The code is this below: #includ...
asked by 02.03.2018 / 20:01