Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <windows.h>
- int users_struct_nmb, cars_struct_nmb, hire_struct_nmb, cost_struct_nmb; // ilosc wpisow do tablicy struktury
- struct users
- {
- char id[5];
- char name[50];
- char lastname[50];
- char birth_date[11];
- char pesel[14];
- char passport_nmb[20];
- char home_adress[50];
- char phone_nmb[15];
- }person[2];
- struct cars
- {
- char id[5];
- char registration_nmb[10];
- char model[20];
- char brand[20];
- char class[5];
- char next_inspection[11];
- char expiry_of_insurance[11];
- }car[100];
- struct hire
- {
- char id[5];
- char customer_id[5];
- char car_id[5];
- char hire_date[11];
- char return_date[11];
- char condition[20];
- }rental[100];
- struct cost
- {
- char id[5];
- char class[5];
- char price[10];
- }price[100];
- void clean()
- {
- system( "cls" );
- }
- void add_client()
- {
- clean();
- int x;// wyjebac nie potrzebne
- int i;
- printf( "Dodawanie klienta\n\n");
- FILE *file; // Zapis z srednikami, pomiędzy srednikami są przypadkowe wartosci
- file=fopen("Klienci.txt","w");
- for(i=0;i<=users_struct_nmb;i++)// to jest zle, ale zapisuje sredniki
- {
- printf("Podaj Id: ");
- scanf("%s",person[i].id);
- printf("Podaj Imie: ");
- scanf("%s",person[i].name);
- printf("Podaj Nazwisko: ");
- scanf("%s",person[i].lastname);
- printf("Podaj Date Urodzenia: ");
- scanf("%s",person[i].birth_date);
- printf("Podaj Pesel: ");
- scanf("%s",person[i].pesel);
- printf("Podaj Numer Paszportu: ");
- scanf("%s",person[i].passport_nmb);
- printf("Podaj Adres Zamieszkania: ");
- scanf("%s",person[i].home_adress);
- printf("Podaj Numer Telefonu: ");
- scanf("%s",person[i].phone_nmb);
- }
- fprintf(file,"%s;%s;%s;%s;%s;%s;%s;%s;\n",
- person[i].id, person[i].name, person[i].lastname, person[i].birth_date,
- person[i].pesel, person[i].passport_nmb, person[i].home_adress, person[i].phone_nmb);
- fclose(file);
- printf( "0.Wstecz\n" ); // wyjebac nie potrzebne
- scanf("%d",&x);// wyjebac nie potrzebne
- }
- int main() {
- add_client();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement