Advertisement
Kocyk

Struktury C

Dec 20th, 2018
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  5.  
  6. typedef struct
  7. {
  8. char imie[20];
  9. char nazwisko[20];
  10. int godziny;
  11. int stawka;
  12. int premia;
  13. }osoba;
  14. void wczytywaniedanych(osoba *osoba)
  15. {
  16.  
  17. printf("Podaj imie i nazwisko osoby\n");
  18. scanf("%s", &osoba->imie );
  19. scanf("%s", &osoba->nazwisko);
  20. printf("Podaj stawke godzinowa\n");
  21. scanf("%d", &osoba->godziny);
  22. printf("Podaj liczbe godzin\n");
  23. scanf("%d", &osoba->godziny);
  24. printf("Podaj premie\n");
  25. scanf("%d", &osoba->premia);
  26. // printf("%d",osoba->godziny);
  27. }
  28. void wyswietlanie(osoba osoba)
  29. {
  30. printf("%s %s stawka: %d",osoba.imie,osoba.nazwisko,osoba.godziny);
  31. }
  32. float obliczanko(osoba janusz)
  33. {
  34. float y;
  35. y=janusz.godziny*janusz.stawka *(1+janusz.premia /100.);
  36. printf("%f",y);
  37. return y;
  38. }
  39. int main()
  40. {
  41. osoba osoba1;
  42. wczytywaniedanych(&osoba1);
  43. //wyswietlanie(osoba1);
  44. printf("Osoba ma otrzymac %.2f ", obliczanko(osoba1));
  45. return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement