Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3.  
  4. struct bike_t{
  5. int size;
  6. int gears;
  7. char man[50];
  8. char model[15];
  9. char ramka;
  10. int price;
  11. };
  12.  
  13. struct bikeshop_t{
  14. int bikes;
  15. int cap;
  16. struct bike_t shop[50];
  17. };
  18.  
  19. struct bikeshop_t add_bike(struct bike_t bike,struct bikeshop_t bikeshop){
  20. if (bikeshop.bikes<bikeshop.cap){
  21. bikeshop.shop[bikeshop.bikes]=bike;
  22. bikeshop.bikes++;
  23. }
  24. return bikeshop;
  25. }
  26.  
  27.  
  28. int main(){
  29. struct bike_t bikem;
  30. struct bikeshop_t bikeshopm;
  31. bikeshopm.cap=5;
  32. bikeshopm.bikes=2;
  33. bikem.size=6;
  34. bikem.gears=5;
  35. strcpy(bikem.man,"koce");
  36. strcpy(bikem.model,"coce");
  37. bikem.ramka='L';
  38. bikem.price=1000;
  39.  
  40. struct bikeshop_t added=add_bike(bikem,bikeshopm);
  41. printf("\n size:%d",added.shop[bikeshopm.bikes].size);
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement