Proba 4
Never
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct { char name[30]; char surname[30]; char JMBG[14]; }Person; typedef struct { char brand[20]; char registration[10]; Person owner; }Car; void showbinary(FILE *inb) { fseek(inb, 0, SEEK_SET); Car x; while (1) { fread(&x, sizeof(Car), 1, inb); if (feof(inb)) { break; } printf("%s %s - %s %s %s\n", x.brand, x.registration, x.owner.name, x.owner.surname, x.owner.JMBG); } return; } void showcity(FILE *inb, char *a) { fseek(inb, 0, SEEK_SET); Car x; while (1) { fread(&x, sizeof(Car), 1, inb); if (feof(inb)) { break; } if (strncmp(a,x.registration,2)==0) { printf("%s %s - %s %s %s\n", x.brand, x.registration, x.owner.name, x.owner.surname, x.owner.JMBG); } } return; } void changeowner(FILE *inb) { char registration[10]; Person x; Car L; printf("Enter registration: "); gets(registration); printf("Enter the name of new owner: "); gets(x.name); printf("Enter the surname of new owner: "); gets(x.surname); printf("Enter the JMBG of new owner: "); gets(x.JMBG); fseek(inb, 0, SEEK_SET); while (1) { fread(&L, sizeof(Car), 1, inb); if (feof(inb)) { break; } if (strcmp(registration, L.registration) == 0) { L.owner = x; fseek(inb, (-1)*(signed)sizeof(Car), SEEK_CUR); fwrite(&L, sizeof(Car), 1, inb); fseek(inb, 0, SEEK_CUR); } } return; } int main(void) { FILE *inb; char a[3]; inb = fopen("automobili.bin", "rb+"); printf("Enter the city (NI, KV, BG...): "); gets(a); showcity(inb, &a); printf("\n"); changeowner(inb); printf("\n"); showbinary(inb); fclose(inb); printf("\n"); system("pause"); return 0; }
Raw Text
-
pospej
26 sec ago
-
“Peeping?” I cum wet in front of my stepbrother and tease him with my pussy
38 sec ago
-
https://www.facebook.com/bloomcbdgummieswebsite
6 min ago
-
Modern kitchen tiles
C | 14 min ago
-
Discover Top Wedding Venues near Delhi with CYJ for Your Dream Destination Wedding!
15 min ago
-
Html
HTML | 16 min ago
-
Backpacker Nata Ocean Opens Her Legs For BBC Roommate - HORNY HOSTEL
26 min ago
-
Untitled
40 min ago
-
https://twor.microsoftcrmportals.com/forums/support-forum/6653c3ea-9400-ef11-a73d-6045bd3fd1cb
49 min ago
-
t33ns gu
51 min ago