You are on page 1of 1

#include "stdafx.

h"
#include <iostream>
#include <string>
using namespace std;

struct element {
char podatak[10];
element* slijedeci;

};

void pisi(element* tekuci){

while(tekuci!=NULL){

cout<<endl<<tekuci->podatak<<endl;
tekuci=tekuci->slijedeci;
}
cout<<endl;
}

int main(){

element *pocetak_liste,*novi;
pocetak_liste=NULL;
cout<<"upisite sadrzaj liste: "<<endl;
novi= new element;
cin.getline(novi->podatak,10);

while(strcmp(novi->podatak,"")!=0){

novi->slijedeci=pocetak_liste;
pocetak_liste=novi;
novi=new element;
cout<<"upisite sadrzaj liste: "<<endl;
cin.getline(novi->podatak,10);

}
cout<<endl<<"sadrzaj liste je: ";
pisi(pocetak_liste);

system("Pause");
return 0;
}