Professional Documents
Culture Documents
Liste Kodovi
Liste Kodovi
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
int main() {
// Definisanje promenjivih u main-u i poruka za korisnika za unos
prvog clana
struct clan *pocetak, *kraj;
int x; double y;
printf("Unesite prvi clan liste:\n");
scanf("%d%lf", &x, &y);
while (x != -1) {
system("PAUSE");
return 0;
}
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
int main()
{
stampanje(pocetak);
system("PAUSE");
return 0;
}
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
int main(){
int prebroj=br_clanova(pocetak);
printf("%d", prebroj);
system("PAUSE");
return 0;
}
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
int main(){
uvecaj(pocetak);
stampanje(pocetak);
system("PAUSE");
return 0;
}
void uvecaj(struct clan *pok) {
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
//funkcija
struct clan *pronadji (struct clan *pok,int x);
int main(){
//deklaracija struct clana r i pozivanje funkcije pronadji
struct clan r=*pronadji(pocetak, 9);
printf("%d%lf", r);
system("PAUSE");
return 0;
}
6. JEDNOSTRUKA MAKSIMUM
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
int main(){
struct clan *djoka; //definisanje strukture potrebne za poziv
funkcije
djoka = max(pocetak); // funkcija uzima promenjivu tipa struct tako
da promenjivu moramo smestiti u isti tip kad vracamo iz funkcije
printf("%d\n", djoka->x); //stampanje maksimuma,samo x-ta komponenta
system("PAUSE");
return 0;
}
q = pok; //max
pok = pok->sledeci;} //pomeranje pokazivaca na sledeci clan
return q;
}
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
int main(){
kraj->sledeci = dodaj_na_kraj(pocetak, x); //poziv funkcije
kraj = kraj->sledeci; //moramo pomeriti kraj
system("PAUSE");
return 0;
}
struct clan *dodaj_na_kraj(struct clan *pok, int novi) {
if (pok == NULL) {
return pok->sledeci;}
8. JEDNOSTRUKA DODAVANJE NA POETAK
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
int main(){
system("PAUSE");
return 0;
}
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
int main(){
system("PAUSE");
return 0;
}
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
int main(){
pocetak = ukloni_sa_kraja(pocetak);
system("PAUSE");
return 0;
}
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
int main(){
pocetak = ukloni(pocetak);
system("PAUSE");
return 0;
}
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
int main(){
struct clan *q1;
q1 = pocetak;
while(q1->x!=-1){
q1 = q1->sledeci;
}
system("PAUSE");
return 0;
}
r2->sledeci = r1->sledeci;
free(r1);
return pok;}