#include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef struct lista
{
char nombre[100];
char apellido[100];
char rut[100];
char f_nac[100];
int edad;
}BD;
BD llenar(BD nuevo)
{
printf("\nIngrese su nombre: ");
gets(nuevo.nombre);
printf("\nIngrese el Apellido: ");
gets(nuevo.apellido);
printf("\nIngrese Rut: ");
gets(nuevo.rut);
printf("\nIngrese fecha de Nacimiento: ");
gets(nuevo.f_nac);
printf("\nIngrese su edad: ");
scanf("%d", &(nuevo.edad));
getchar();
return nuevo;
}
void imprimir(BD nuevo)
{
printf("\nSU NOMBRE ES: %s", nuevo.nombre);
printf("\nSU APELLIDO ES: %s", nuevo.apellido);
printf("\nSU RUT ES: %s", nuevo.rut);
printf("\nSU FECHA DE NACIMIENTO ES: %s", nuevo.f_nac);
printf("\nSU EDAD ES: %d", nuevo.edad);
}
void busqueda(BD lista[], char rut[], int x)
{
int i;
for(i=0;i<x;i++)
{
if(strcmp(lista[i].rut, rut)==0)
{
imprimir(lista[i]);
break;
}
}
}
int main()
{
BD dato[100];
int n, c;
char brut[100];
system("Color 1f");
printf("INGRESE CANTIDAD DE PERSONAS: ");
scanf("%d", &n);
getchar();
for(c=0;c<n;c++)
{
dato[c]=llenar(dato[c]);
}
for(c=0;c<n;c++)
{
imprimir(dato[c]);
}
printf("\nINGRESE RUT A BUSCAR: ");
gets(brut);
busqueda(dato, brut, n);
getchar();
getchar();
return 0;
}
Un Lugar en donde comparto mis videos favoritos, algunas frases célebres o mensaje que Dios me ha dado
Ads by Smowtion
Anuncios
Anuncios
jueves, 17 de mayo de 2012
Código semana del 17-05-2012
Código visto esta semana
jueves, 3 de mayo de 2012
Ejercicios Ayudantía 3/05/2012
Les Adjunto los ejercicios vistos en las Ayudantías:
http://www.mediafire.com/?16se3t8gztkln4a
http://www.mediafire.com/?16se3t8gztkln4a
Suscribirse a:
Entradas (Atom)