Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- typedef struct
- {
- char imie[20];
- char nazwisko[20];
- int godziny;
- int stawka;
- int premia;
- }osoba;
- void wczytywaniedanych(osoba *osoba)
- {
- printf("Podaj imie i nazwisko osoby\n");
- scanf("%s", &osoba->imie );
- scanf("%s", &osoba->nazwisko);
- printf("Podaj stawke godzinowa\n");
- scanf("%d", &osoba->godziny);
- printf("Podaj liczbe godzin\n");
- scanf("%d", &osoba->godziny);
- printf("Podaj premie\n");
- scanf("%d", &osoba->premia);
- // printf("%d",osoba->godziny);
- }
- void wyswietlanie(osoba osoba)
- {
- printf("%s %s stawka: %d",osoba.imie,osoba.nazwisko,osoba.godziny);
- }
- float obliczanko(osoba janusz)
- {
- float y;
- y=janusz.godziny*janusz.stawka *(1+janusz.premia /100.);
- printf("%f",y);
- return y;
- }
- int main()
- {
- osoba osoby[3];
- int rozmiar=sizeof(osoba);
- FILE *f;
- f=fopen("firma.txt", "rb");
- int i=0;
- while(fread(&osoby[i],rozmiar,1,f)==1)
- {
- wyswietlanie(osoby[i]);
- i++;
- }
- //wyswietlanie(osoba1);
- //printf("Osoba ma otrzymac %.2f ", obliczanko(osoba1));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement