Exemple #1
0
int main(int argc, char *argv[]) {
	char nom[10][50],i,resp[2],editnom[30],valor[50];
	int fecha[10][3],edad[10],pos=-1,totalfecha[10];
	for(i=0;i<10;i++){
		fecha[i][0]=-1;
		fecha[i][1]=-1;
		fecha[i][2]=-1;
		edad[i]=-1;
	}
	for(i=0;i<10;i++){
		do{
		
			printf("Ingrese el nombre n:%d\n>",(i+1));
			gets(nom[i]);
			fflush(stdin);
			if(comparar(nom[i],nom,i)==0 ){
				printf("Nombre repetido\n");
			}
		}while(comparar(nom[i],nom,i)==0 );
		do{
			printf("Ingrese  fecha de ingreso ej 12/12/1993\n>");
			scanf("%d/%d/%d",&fecha[i][0],&fecha[i][1],&fecha[i][2]);
			//printf("%d/%d/%d",fecha[0],fecha[1],fecha[2]);
			fflush(stdin);
			if(sacarFecha(fecha[i])==0){
				printf("Error,FECHA incorrecta\n");
			}}while(sacarFecha(fecha[i])==0);	
			
		
	}//Parte uno  ingreso

	printf("¿Deseas editar alguna fecha?\n>");
	scanf("%s",resp);
	fflush(stdin);
	while(strcmp(strlwr(resp), "si")==0){//Parte dos
		printf("Ingrese el nombre que deseas editar\n>");
		gets(editnom);
		fflush(stdin);
		for(i=0;i<10;i++){
			//printf("%s\n",nom[i]);
			if((strcmp(nom[i],editnom)==0)||(strcmp(nom[0],editnom))){
				pos=i;
				break;
				
				}
			
		}
		if(pos==-1){
			printf("Nombre no encontrado\n");
		}
		else{
		
			printf("La fecha es %d/%d/%d\n",fecha[pos][0],fecha[pos][1],fecha[pos][2]);
			do{
				printf("Ingrese  la nueva fecha ej 12/12/1993\n>");
				scanf("%d/%d/%d",&fecha[pos][0],&fecha[pos][1],&fecha[pos][2]);
				fflush(stdin);
				if(sacarFecha(fecha[pos])==0){
					printf("Error,FECHA incorrecta\n");
				}}while(sacarFecha(fecha[pos])==0);
			printf("Fecha cambia correctamente\n");
		}
			printf("¿Deseas editar alguna fecha?\n>");
			scanf("%s",resp);
			fflush(stdin);
			pos=-1;
		}//Parte dos editar nombre
		
		
		calcularEdad(fecha,edad);
		ordenarEdad(nom,fecha,edad);
		printf("Nombre     fecha      anio\n");
		for(i=0;i<10;i++){
			printf("%s \t ",nom[i]);
			printf("%d/%d/%d\t",fecha[i][0],fecha[i][1],fecha[i][2]);
			printf("%d\n",edad[i]);
		}//parte 3 mostrar en pantalla
	
	
	return 0;
}
Exemple #2
0
String* Persona::buscarDatos(String ci)
{                  
        String* dato = new String[20];
        if(ci!=""){
        dato[0]=ci;
        for(int i=1;i<Form4->Persona->RowCount;i++)
        {
                if (Form4->Persona->Cells[1][i]==ci)
                {
                        dato[1]=Form4->Persona->Cells[9][i];
                        dato[2]=Form4->Persona->Cells[2][i];
                        dato[3]=Form4->Persona->Cells[3][i];
                        dato[4]=Form4->Persona->Cells[4][i];
                        dato[5]=calcularEdad(Form4->Persona->Cells[4][i]);
                        dato[6]=Form4->Persona->Cells[5][i];
                        dato[7]=Form4->Persona->Cells[6][i];
                        dato[8]=Form4->Persona->Cells[7][i];
                        dato[9]=Form4->Persona->Cells[8][i];

                        if(dato[1]=="Paciente")
                        {
                                for(int j=1;j<Form4->Historia->RowCount;j++)
                                {
                                        if(ci==Form4->Historia->Cells[0][j])
                                        {
                                                dato[10]=Form4->Historia->Cells[1][j];
                                                dato[11]=Form4->Historia->Cells[2][j];
                                                dato[12]=Form4->Historia->Cells[3][j];
                                                dato[13]=Form4->Historia->Cells[4][j];
                                                dato[14]=Form4->Historia->Cells[5][j];
                                                dato[15]=Form4->Historia->Cells[6][j];
                                                dato[16]=Form4->Historia->Cells[7][j];
                                        }
                                }
                        }

                        if(dato[1]=="Representante")
                        {
                                dato[10]=Form4->Persona->Cells[10][i];
                                for(int j=1;j<Form4->Reprecentante->RowCount;j++)
                                {
                                        if(ci==Form4->Reprecentante->Cells[0][j])
                                        {
                                                dato[11]=Form4->Reprecentante->Cells[1][j];
                                                dato[12]=Form4->Reprecentante->Cells[2][j];
                                                dato[13]=Form4->Reprecentante->Cells[3][j];
                                        }
                                }
                        }

                        if(dato[1]=="Empleado")
                        {
                                for(int j=1;j<Form4->Empleado->RowCount;j++)
                                {
                                        if(ci==Form4->Empleado->Cells[0][j])
                                        {
                                                dato[11]=Form4->Empleado->Cells[1][j];
                                                dato[12]=Form4->Empleado->Cells[2][j];
                                                dato[13]=Form4->Empleado->Cells[3][j];
                                                dato[14]=Form4->Empleado->Cells[4][j];
                                                dato[15]=Form4->Empleado->Cells[5][j];
                                                dato[16]=Form4->Empleado->Cells[6][j];
                                                dato[17]=Form4->Empleado->Cells[7][j];
                                        }
                                }
                        }
                }
        }
        }
        else
        {
                ShowMessage("No hay datos para mostrar");
        }
        return dato;
}