# Posted By

Quake6 on 11/11/12

# Statistics

Viewed 110 times
Favorited by 0 user(s)

# Evidencija Å¾ivotinja, lista polja - Zadatak_1, Strukture podataka

/ Published in: C++
Save to your folder(s)

Evidencija Å¾ivotinja pomoÄ‡u lista polja

Copy this code and paste it in your HTML
`int LocateL(int n,t*list_head){    for(int i=0; i<list_head->kursor; i++)    {        if(n==list_head->jedna_zivotinja[i]->sifra)return i;    }    return list_head->kursor;}void InsertL(z*novi, int k, t*list_head){    if(k>EndL(list_head))        {         }    else    {        for (int i = EndL(list_head); i > k; i--)        {            list_head->jedna_zivotinja[i] = list_head->jedna_zivotinja[i-1];        }        list_head->jedna_zivotinja[k] = novi;        list_head->kursor = list_head->kursor + 1;    }}  struct z{    int sifra,dan,mjesec,godina;    char naziv[60];    char vrsta[60];    float cijena;}; struct t{    z*jedna_zivotinja[1000];    int kursor;}; int DeleteL(int k, t*list_head){    k-=1;    if(k>EndL(list_head)){}    else    {        for(int i=k; i<EndL(list_head); i++)        {            list_head->jedna_zivotinja[i]=list_head->jedna_zivotinja[i+1];        list_head->kursor=list_head->kursor-1;        return 0;    }}} void DeleteAll(t*list_head){    list_head->kursor=0;} int NumberL(t*list_head){    int k=list_head->kursor;    return k;} z*RetrieveL(int k,t*list_head){    return list_head->jedna_zivotinja[k-1];} int FirstL(t*list_head){    return 0;} int EndL(t*list_head){    return list_head->kursor;} int NextL(int k,t*list_head){    return k+1;} int PreviousL(int k,t*list_head){    return k-1;} t*InitL(t*list_head){    t*novi=new t;    novi->kursor=0;    return novi;}`