Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void pridaj(KNIZNICA **p_zac, int c1){
- KNIZNICA *pom,*p_pred, *novy;
- char s[102];
- int i=0;
- for(pom=(*p_zac);pom->p_dalsi!=NULL;pom=pom->p_dalsi){
- i++;
- if (c1==1){
- novy=(KNIZNICA*) malloc(sizeof(KNIZNICA));
- novy->p_dalsi=*p_zac;
- while ((fgets(s,102,stdin)) != NULL){
- fgets(novy->signatura, 12, stdin);
- fgets(novy->isbn, 15, stdin);
- fgets(novy->nazov, 102, stdin);
- fgets(novy->autor, 102, stdin);
- scanf("%d\n", &novy->datum);
- scanf("%d\n", &novy->preukaz);
- break;}
- break;
- }
- if (i==c1)
- break;
- p_pred=pom;
- }
- if (c1!=1){
- p_pred->p_dalsi=(KNIZNICA*) malloc(sizeof(KNIZNICA));
- if (pom!=NULL)
- while ((fgets(s,102,stdin)) != NULL){
- fgets((p_pred->p_dalsi)->signatura, 12, stdin);
- fgets((p_pred->p_dalsi)->isbn, 15, stdin);
- fgets((p_pred->p_dalsi)->nazov, 102, stdin);
- fgets((p_pred->p_dalsi)->autor, 102, stdin);
- scanf("%d\n", &(p_pred->p_dalsi)->datum);
- scanf("%d\n", &(p_pred->p_dalsi)->preukaz);
- p_pred->p_dalsi->p_dalsi=pom;
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement