Advertisement
mateo3334

Untitled

Jan 21st, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 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. struct cukierek{
  6. char producent[15];
  7. char nazwa[15];
  8. float cena;
  9. float data;
  10. };
  11. struct cukierek wczytaj();
  12. void wypisz(struct cukierek os);
  13. float cenakg(struct cukierek os, int min, int max);
  14. char przeterminowane(struct cukierek os, int data);
  15. int main(int argc, char *argv[]) {
  16. int n,i;
  17. printf("Ile cukierkow chcesz wprowadzic?\n");
  18. scanf("%d",&n);
  19. struct cukierek os[n];
  20. for(i=0;i<n;i++){
  21. fflush(stdin);
  22. printf("Slodycz numer %d\n", i+1);
  23. os[i]=wczytaj();
  24. printf("\n");
  25.  
  26. }
  27. for(i=0;i<n;i++){
  28. printf("Slodycz numer %d\n", i+1);
  29. wypisz(os[i]);
  30. }
  31.  
  32. return 0;
  33. }
  34. struct cukierek wczytaj(){
  35. struct cukierek os;
  36. printf("Podaj producenta:\n");
  37. scanf("%s",os.producent);
  38. printf("Podaj nazwe:\n");
  39. scanf("%s",os.nazwa);
  40. printf("Podaj cene za kilogram:\n");
  41. scanf("%f",os.cena);
  42. printf("Podaj date waznosci produktu:\n");
  43. scanf("%f",os.data);
  44.  
  45. }
  46. void wypisz(struct cukierek os){
  47. printf("%s %s %f PLN %f", os.producent,os.nazwa,os.cena,os.data);
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement