Questions tagged as 'c'

1
answer

Error returning items not repeated and in alphabetical order

The code is in the image. Valentina is a very dedicated woman who works late every day.To save time, she makes the market shopping list in an application and usually writes down each item at the same time that she notices it house. The prob...
asked by 04.11.2018 / 02:44
1
answer

How to create a function in C that searches for words in txt files in a predefined directory?

void pesquisarexerword() { DIR *dir; char *strdir, *strget, t, *str; struct dirent *lsdir, *dirarq; FILE *arq; do{ printf("\n Digite o Diretorio que Deseja Fazer a Pesquisa:\n"); system("pause"); ff...
asked by 25.11.2017 / 19:56
3
answers

I need to make a function that passed an array n * m, be transformed into a one-dimensional vector of n * m

int* Vetor_Unidim(int **matriz, int n, int m){ int *vetor = (int*)malloc((n*m)*sizeof(int)); int *p; p = *matriz; int tam = n*m; int i; for(i = 0; i<n; i++){ p = matriz[i]; for(j= 0; j<m ; j++, p++){...
asked by 08.07.2018 / 23:34
2
answers

How to do if several variables with "or" work?

When I run this program, I choose the integer 1 and enter the two if 's. Why does it enter n==1 and n!=1 at the same time? #include<stdio.h> int main(){ int n; puts("ESCOLA UMA OPCAO"); puts("1....
asked by 31.01.2016 / 00:57
1
answer

C accent

How do I accent the vowels without having to use the locale.h library? I know that £ corresponds to E as they would for the other vowels?     
asked by 10.10.2017 / 15:56
1
answer

Performance difference between C and MatLab

Friends, I have created two apparently identical cryptographic codes, one in C language and the other in MatLab, the code in MatLab has more functions, that is, it is more extensive and performs more functions than the C code. I am using the...
asked by 29.06.2017 / 20:44
1
answer

Bubble sort improved [closed]

Although you have followed the pseudocode correctly, the program is not sorting the array correctly. Why? #include <bits/stdc++.h> void bubbleSortM( int A[], int n ) { int i,j,aux; bool troca; for(i=1; i<n; i++) troca =...
asked by 21.03.2018 / 02:37
2
answers

Recursively print subtrings

I need to print the substrings of a string, for example: OPEN, the substrings are OPEN, ABRI, ABR, AB, A. How do I do this? Because I can only print the entire string. #include <stdio.h> #include <stdlib.h> #include <string.h>...
asked by 10.06.2018 / 22:40
1
answer

Would you like to improve the performance of this code?

I already found the resolution of this question and all the results are in agreement with what the question asks, but I think the solution is a bit slow, because it is giving Time limit exceeded Issue Link #include <stdio.h> #includ...
asked by 20.01.2018 / 22:16
2
answers

Error in procedure case 3

I have problems in my case 3 of my code in C, it should compare the two strings with the strcmp function filmeIgual=strcmp(filmePesquisa,v[x].nome); and if the result is zero, if(filmeIgual == 0) , the strings will be the same. But...
asked by 11.06.2017 / 06:35