Questions tagged as 'scanf'

2
answers

Problem reading characters with Scanf in C

I have a problem with the following program: #include <stdio.h> int main() { char a, b; printf("Ingrese el primer caracter:\n"); scanf("%c", &a); printf("Se leyó el caracter: %c\n", a); printf("Ingrese el segundo...
asked by 02.08.2017 / 18:58
1
answer

Store information in an array and display it

I have a code about movies that have their types in which I try to store their information in an array. At the time of collecting the data I must be doing it wrong since when using the function to show the crashea movies. Sometimes I print...
asked by 15.04.2018 / 21:21
1
answer

Doubt C input flows

The following program works well for me in C ++ with its respective changes (cin and cout), however, when passing it to C, the input provided by the keyboard fails. #include <stdio.h> #include <stdlib.h> struct etapa{ int h,...
asked by 13.09.2017 / 18:27
1
answer

You doubt scan character C

I'm starting with C and although I know I should do it, I do not understand why I should put a line break before scanning the character. scanf (" \ n % c", & c) #include <stdio.h> int main() { printf("Cadena: "); scanf("%s",...
asked by 18.11.2018 / 18:07
2
answers

Read line of text file with fixed format

I'm not sure which is the best way to read The following text file which was generated in the following way: Struct int nro_orden; char desc[30]; int cantidad; fprintf(pf,"%03d%-30s%03d\n",pedido[i].nro_orden,pedido[i].desc,pedido[i].cant...
asked by 16.07.2018 / 00:12