Advertisement
Jorge_Lugo97

Registros

Nov 17th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.81 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. typedef struct registro{    
  5.     char nombre[15];
  6.     char apellidos[25];
  7. }
  8.     registro;
  9.  
  10. int main(){
  11.    
  12.     int exit=0, i;
  13.     registro reg[3];
  14.         do{
  15.             for(i=0;i<3;i++){
  16.             printf(" Persona No. %d\n", i+1);
  17.             printf(" Nombre: ");
  18.             setbuf(stdin, NULL);
  19.             gets(reg[i].nombre);
  20.             printf(" Apellido: ");
  21.             setbuf(stdin, NULL);
  22.             gets(reg[i].apellidos);
  23.             }
  24.                 for(i=0;i<3;i++){
  25.                 printf("\n");
  26.                 printf("\n\t Persona No. %d", i+1);
  27.                 printf("\n\t Nombre: %s", reg[i].nombre);
  28.                 printf("\n\t Apellido: %s", reg[i].apellidos);
  29.                 printf("\n");
  30.                 }
  31.  
  32.              exit=1;
  33.         }
  34.        
  35.         while(exit!=1);
  36.         return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement