elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Los 10 CVE más críticos (peligrosos) de 2020


  Mostrar Mensajes
Páginas: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 [16]
151  Programación / Programación C/C++ / Re: [C] Problemas para leer datos en: 16 Junio 2010, 19:03 pm
Muchas gracias.
152  Programación / Programación C/C++ / Re: [C] Problemas para leer datos en: 16 Junio 2010, 18:51 pm
 :-\ No comprendo tu respuesta... O tu link... O no encuentro la respuesta a setbuf.
153  Programación / Programación C/C++ / Re: [C] Problemas para leer datos en: 16 Junio 2010, 18:39 pm
Muchas gracias... Una pregunta, sería correcto utilizar:

Código
  1. setbuf(stdin, NULL);
:huh:
154  Programación / Programación C/C++ / [C] Problemas para leer datos en: 16 Junio 2010, 17:59 pm
Tengo el siguiente problema:

Código:
cbug@debian:~$ ./a.out 
Ingrese cantidad de personas>
1   
---INGRESO DE PACIENTES---
Ingrese nombre>
Ingrese fecha visita
|

Resulta que no puedo ingresar el nombre.

Código
  1. #include <stdio.h>
  2.  
  3. /* Programa para manejo de una lista de pacientes */
  4. /* Se mostraran los pacientes con una fecha determinada de visita */
  5.  
  6. #define MAX 30
  7.  
  8. typedef struct Paciente{
  9. char nombre[20];
  10. char direccion[20];
  11. char fechanac[13];
  12. char sexo;
  13. char fechavisita[13];
  14. char problema[100];
  15. }PACIENTE;
  16.  
  17. void Ingreso_Lista(PACIENTE P[], int N);
  18. void Ingreso_Paciente(PACIENTE *P);
  19. void Muestra(PACIENTE P[], int N, char F[]);
  20.  
  21. int main(){
  22. int cantidad;
  23. PACIENTE MiLista[MAX];
  24. char fecha[13];
  25. puts("Ingrese cantidad de personas>");
  26. scanf("%d", &cantidad);
  27. Ingreso_Lista(MiLista, cantidad);
  28. puts("Ingrese fecha a buscar>");
  29. fgets(fecha, sizeof(char)*13, stdin);
  30. Muestra(MiLista, cantidad, fecha);
  31. }
  32.  
  33. void Ingreso_Paciente(PACIENTE *P){
  34. puts("Ingrese nombre>");
  35. fgets(P->nombre,sizeof(char)*20,stdin);
  36. puts("Ingrese fecha visita");
  37. fgets(P->fechavisita,sizeof(char)*13,stdin);
  38. }
  39.  
  40. void Ingreso_Lista(PACIENTE P[], int N){
  41. int i;
  42. puts("---INGRESO DE PACIENTES---");
  43. fflush(stdout);
  44. for(i = 0; i < N; i++)
  45. Ingreso_Paciente(&P[i]);
  46. puts("---FINALIZADO---");
  47. }
  48.  
  49. void Muestra(PACIENTE P[], int N, char F[]){
  50. int i;
  51. for(i = 0; i < N; i++)
  52. if(*P[i].fechavisita == *F)
  53. puts(P[i].nombre);
  54. }
Páginas: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 [16]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines