Questions tagged as 'c'

2
answers

Remove element from a Vector in "C"

I need to fill two vectors, A and B, with 10 elements each, then make the Intersection and the Union, in the union, I have to remove the repeated elements. At the moment, the intersection was made, within the intersection for I put in another...
asked by 20.05.2018 / 18:03
1
answer

How to compare two lists chained in C?

I'm having trouble with this issue: -I have to compare two linked lists and return 1 if they are equal or 0 if they are not. The function is like this and I can not progress: struct Node { int data; struct Node *next; } int...
asked by 11.04.2018 / 01:57
3
answers

Identify a specific word in a C ++ String, is there any function ready for it? Or just the nail itself?

Hello, I'm getting a series of strings from a .txt file and putting them in a vector. But have a problem, the strings come with an unwanted start, example: Depende: lsb-release Depende: libatk1.0-0 Depende: libc6 Depende: libcairo-g...
asked by 08.04.2018 / 14:31
1
answer

Why did I have to use freopen in this case?

I have the following code: #include <stdio.h> int main(void){ FILE *ptr_file; ptr_file=fopen("archive.txt", "r"); short size=0; char c; while(!feof(ptr_file)){ c=getc(ptr_file); if(c=='\n'){...
asked by 10.04.2018 / 02:30
1
answer

Sort matrix of n rows having as criterion the value of the column in C

I have the following code: int** ordena(int **v, int tam) { int i, j,aux; int swap[3]; for (i = 0; i > (tam-1); i++){ aux = i; for (j = (i+1); j > tam; j++) { if(v[j][1] > v[aux][1]) { aux = j...
asked by 20.04.2018 / 00:11
1
answer

Compare a vector of char?

Good people I have the following doubt why I can not compare two vectors of type char using relational operators? I know that vectors are a compound type and that the characters are in a static area am I right? But what influences at the time...
asked by 21.04.2018 / 21:10
1
answer

Doubt with excel files

I have a list of dates in a BTH.cvs excel file. I want to copy the whole file to another new.cvs, however the a.exe stops working. #include <stdio.h> #include <stdlib.h> int main(int argc,char **argv){ FILE *in = fopen("BTH.cs...
asked by 08.03.2018 / 21:50
1
answer

Use vector in external functions a main

I learned to use functions a few days ago and now I wanted to use a vector in them. My teacher taught me, but my code just does not work. One of the numbers ends up being repeated. Here is the code: #include <stdio.h> #include <stdlib...
asked by 09.06.2016 / 21:10
1
answer

How to decrease, taking only one number from the other value?

In the final value was to have the total of the notes greater than 7, another condition would be that the user has to enter a number between 0 and 10, then any number outside this would give "invalid message", and would have its decrement, so fo...
asked by 01.04.2018 / 02:51
1
answer

How to use atof in C

Could you help me use the atof function? My code is giving "access violation" on the line in which I am using atof, I already tried to change the type of array "given" for both int and float int main() { char pilha[10]; int i; int dado[10]; in...
asked by 31.03.2018 / 15:04