Guest User

Untitled

a guest
Apr 20th, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. typedef struct datum {
  6. unsigned int den,mesic,rok;
  7. } typDatum;
  8.  
  9. typedef struct Auta{
  10. char spz[10],typAuta[30];
  11. typDatum datumVyroby;
  12. unsigned najeteKilometry,cenaZaDen;
  13. } typAuto;
  14.  
  15. typAuto addCar(char *spz,char *typ,int denVyroby, int mesicVyroby, int rokVyroby, int kilometry, int cenaDen) {
  16. typAuto newCar;
  17. strcpy(newCar.spz,spz);
  18. strcpy(newCar.typAuta,typ);
  19. newCar.datumVyroby.den = denVyroby;
  20. newCar.datumVyroby.mesic = mesicVyroby;
  21. newCar.datumVyroby.rok = rokVyroby;
  22. newCar.najeteKilometry = kilometry;
  23. newCar.cenaZaDen = cenaDen;
  24. return newCar;
  25. }
  26.  
  27.  
  28. int main()
  29. {
  30.  
  31.  
  32. typAuto car;
  33.  
  34. strcpy(car.spz,"TN-953 AC");
  35. strcpy(car.typAuta,"BMW");
  36. car.datumVyroby.den = 3;
  37. car.datumVyroby.mesic = 5;
  38. car.datumVyroby.rok = 2003;
  39. car.najeteKilometry = 31423;
  40. car.cenaZaDen = 10000;
  41.  
  42. typAuto noveAuto;
  43. noveAuto = addCar("WTF","FIAT",3,11,2012,1000000,99999);
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53. return 0;
  54. }
Add Comment
Please, Sign In to add comment