Questions tagged as 'c'

0
answers

How can I read a CSV file with different line types?

I'm trying to read a CSV file that has different rows. I'm using fgets and strtok to save to a list. the problem is that being different rows I do not know how to stop and move on to the next one. typedef struct{ int id_viagem; int duracao; in...
asked by 25.05.2017 / 00:18
1
answer

How to make a transposed matrix of dimensions chosen by the user in c?

I need to make an algorithm that transposes an array whose size should be chosen by the user. I have already written a code, but it does not work correctly for arrays whose number of rows is less than the number of columns. Here is the cod...
asked by 20.05.2017 / 17:37
1
answer

Problems scanning strings inside the switch command (C)

I am trying to make a program that encodes and decodes strings that are given by the user by the cesar method, using switch-case to select what should be done, however when trying to read a string inside the case of the case this occurs) the pro...
asked by 27.05.2017 / 20:28
1
answer

Copying strings in C [duplicate]

I'd like some help on the following question: I have a char with a text of 32 characters, so I would like to know how to separate this char into two of 16 characters. Type: char textao[32] = "Oi meu nome e Cesar tudo bem...
asked by 25.05.2017 / 02:30
0
answers

Method verification problem

I made this function for the old game: void jogadaPC(char m[][3], char opc) { puts("\nVez do computador."); sleep(1); int linha = rand() % 2; int coluna = rand() % 2; bool vazio = localVazio(m, linha, coluna); bool...
asked by 02.06.2017 / 04:48
0
answers

struct that stores number of rows and columns of array and a vector

I used a struct to store the number of rows (m) and columns (n) of the array and another to store number of columns of the vector (n). I make the product of two arrays in the function prod() and the product of a matrix with a vecto...
asked by 25.05.2017 / 23:49
1
answer

PROBLEM WITH FGETS in C [duplicate]

#include <stdio.h> #include <stdlib.h> /*definir operador lógico para chuva (1 para TRUE e 0 para FALSE) */ #define TRUE (1==1) #define FALSE (!TRUE) struct eventos_atm_st { float temp; float press; int chuva; int mm_prec; char n...
asked by 13.05.2017 / 04:20
2
answers

Problems with reading the struct in function

For several days I've been trying to understand why this error occurs, but I have not found it anywhere. It is as follows, I declared a vector of the data struct and passed that vector to the function that receives it with a pointer type paramet...
asked by 13.05.2017 / 19:33
2
answers

Doubt about code in C

Hello. I am in doubt about this code. In "case 1", when I run, this appears to me: Theproblemisthatnoneofthediscountsapply.Ihavetriedotherwaystomountthisoperation,butallofthemresultinanerror.Nowincase2,Iwantedtoknowifthereisawayto"if (c =...
asked by 13.05.2017 / 14:51
1
answer

Progressively Removing from the List

#include <stdio.h> #include <stdlib.h> typedef struct ListElmt_{ int data; struct ListElmt_ *next; } ListElmt; typedef struct List_ { int size; ListElmt *head; ListElmt *tail; } List; List *list_init(){ List *list = (List *)...
asked by 20.05.2017 / 19:33