Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #define NFIL 6 //los valores numéricos de NFIL y NCOL pueden cambiar
- #define NCOL 4
- #define LIBRE 0
- #define OCUPADO 1
- #define MAX 13
- struct Tfecha {
- int dia, mes, anio;
- };
- // Datos de un vuelo:
- struct TDatosVuelo {
- char compania [10];
- char origen [10];
- char numVuelo [10];
- char destino [10];
- struct Tfecha fecha;
- int hora [2];
- };
- // Datos de la ocupación de un asiento
- struct TAsientos {
- int ocupado; /* 1=ocupado , 0=libre */
- char nombre[20]; /* nombre del pasajero */
- char nacionalidad[10]; /* nacionalidad del pasajero */
- int facturado; /* 1=si , 0=no */
- };
- // Datos del avión:
- struct TAvion
- {
- struct TDatosVuelo DVuelo;
- struct TAsientos Asientos [NFIL][NCOL];
- };
- void lectura(struct TAvion *a);
- void pasajeros(struct TAvion *a);
- int main()
- {
- struct TAvion avion1;
- //avion1.Asientos[NFIL][NCOL].facturado={0};
- printf("%dx%d",avion1.Asientos[0][0].facturado,avion1.Asientos[0][1].facturado);
- //lectura(&avion1);
- return 0;
- }
- void lectura(struct TAvion *a)
- {
- int pas=0,i,j;
- char string[MAX];
- FILE *fich;
- fich=fopen("datVuelo.txt","r");
- if(fich==NULL)
- printf("error fichero.\n");
- else
- {
- while(!feof(fich))
- {
- fscanf(fich,"%s",a->DVuelo.compania);
- fscanf(fich,"%s",a->DVuelo.origen);
- fscanf(fich,"%s",a->DVuelo.numVuelo);
- fscanf(fich,"%s",a->DVuelo.destino);
- fscanf(fich,"%d %d %d",a->DVuelo.fecha.dia,a->DVuelo.fecha.mes,a->DVuelo.fecha.anio);
- fscanf(fich,"%d %d",a->DVuelo.hora[0],a->DVuelo.hora[1]);
- for(pas=0;pas<5;pas++)
- {
- fscanf(fich,"%d %d",i,j);
- }
- }
- fclose(fich);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement