Advertisement
Guest User

Untitled

a guest
Dec 1st, 2015
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. void pridaj(KNIZNICA **p_zac, int c1){
  2. KNIZNICA *pom,*p_pred, *novy;
  3. char s[102];
  4. int i=0;
  5. for(pom=(*p_zac);pom->p_dalsi!=NULL;pom=pom->p_dalsi){
  6. i++;
  7. if (c1==1){
  8. novy=(KNIZNICA*) malloc(sizeof(KNIZNICA));
  9. novy->p_dalsi=*p_zac;
  10. while ((fgets(s,102,stdin)) != NULL){
  11. fgets(novy->signatura, 12, stdin);
  12. fgets(novy->isbn, 15, stdin);
  13. fgets(novy->nazov, 102, stdin);
  14. fgets(novy->autor, 102, stdin);
  15. scanf("%d\n", &novy->datum);
  16. scanf("%d\n", &novy->preukaz);
  17. break;}
  18. break;
  19. }
  20. if (i==c1)
  21. break;
  22. p_pred=pom;
  23. }
  24.  
  25. if (c1!=1){
  26. p_pred->p_dalsi=(KNIZNICA*) malloc(sizeof(KNIZNICA));
  27.  
  28. if (pom!=NULL)
  29. while ((fgets(s,102,stdin)) != NULL){
  30. fgets((p_pred->p_dalsi)->signatura, 12, stdin);
  31. fgets((p_pred->p_dalsi)->isbn, 15, stdin);
  32. fgets((p_pred->p_dalsi)->nazov, 102, stdin);
  33. fgets((p_pred->p_dalsi)->autor, 102, stdin);
  34. scanf("%d\n", &(p_pred->p_dalsi)->datum);
  35. scanf("%d\n", &(p_pred->p_dalsi)->preukaz);
  36.  
  37. p_pred->p_dalsi->p_dalsi=pom;
  38. break;
  39. }
  40.  
  41.  
  42. }
  43.  
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement