Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main(void)
- {
- typedef struct flights
- { int flight_id;
- char flight_from[20];
- char flight_to[20];
- char flight_start_date[10];
- char flight_start_time[6];
- char flight_finish_date[10];
- char flight_finish_time[6];
- int flight_max_seats;
- } flights;
- struct flights jeden;{
- scanf("%d",&(jeden.flight_id));}
- printf("Miasto odlotu:\n");
- fflush(stdout);
- scanf("%s",&jeden.flight_from);
- printf("Podaj miasto docelowe:\n");
- fflush(stdout);
- scanf("%s",&jeden.flight_to);
- printf("Podaj date wylotu:\n ");
- fflush(stdout);
- scanf("%s",&jeden.flight_start_date);
- printf("Podaj godzine wylotu:\n ");
- fflush(stdout);
- scanf("%s",jeden.flight_start_time);
- printf("Podaj date przylotu:\n ");
- fflush(stdout);
- scanf("%s",jeden.flight_finish_date);
- printf("Podaj godzine przylotu:\n ");
- fflush(stdout);
- scanf("%s",jeden.flight_finish_time);
- printf("Podaj liczbê miejsc:\n ");
- fflush(stdout);
- scanf("%d",&jeden.flight_max_seats);
- //jeden.flight_id = 23;
- //strcpy ( jeden.flight_from, "abc");
- FILE *fp;
- if((fp = fopen("flights_db.txt", "w+")) == NULL)
- {
- printf("Nie mozna otworzyc pliku do zapisu\n");
- exit(1);
- }
- fprintf (fp, "%d;;%s;;%s\n",jeden.flight_id,jeden.flight_from, jeden.flight_to);
- fclose(fp);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement