Advertisement
Guest User

Untitled

a guest
Jun 19th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.06 KB | None | 0 0
  1. /*#include <iostream>
  2. using namespace std;
  3.  
  4. struct cvor{
  5.  int n;
  6.  cvor *veza;
  7. };
  8.  
  9. struct proizvod{
  10.  string naziv;
  11.  int sifra;
  12. double cijena;
  13. };
  14. void ispisiListu(cvor* lista)
  15.  {
  16.     cvor* tekuci;
  17.     tekuci=lista;
  18.     while (tekuci !=0){
  19.         cout<<tekuci->n<<endl;
  20.         tekuci=tekuci->veza;
  21.     }
  22.  }
  23.  
  24. int main(){
  25.   cvor* lista=NULL;
  26.   int a;
  27.  
  28. do{
  29.     cout<<"upisi br ili 0 za kraj: ";
  30.     cin>>a;
  31.     cvor* novi= new cvor;
  32.     novi->n=a;
  33.     novi->veza=lista;
  34.     lista=novi;
  35.   }while(a!=0);
  36.  
  37. ispisiListu(lista);
  38.  
  39. return 0;
  40. }
  41. */
  42. #include <iostream>
  43. using namespace std;
  44.  
  45. struct cvor{
  46.  int n;
  47.  cvor *veza;
  48. };
  49.  
  50. void ispisiListu(cvor* lista)
  51.  {
  52.     cvor* tekuci;
  53.     tekuci=lista;
  54.     while (tekuci !=0){
  55.         cout<<tekuci->n<<endl;
  56.         tekuci=tekuci->veza;
  57.     }
  58.  }
  59.  
  60. int main(){
  61.   cvor* lista=NULL;
  62.   int a;
  63.  
  64. do{
  65.     cout<<"upisi br ili 0 za kraj: ";
  66.     cin>>a;
  67.     *rep=
  68.     cvor* novi= new cvor;
  69.     novi->n=a;
  70.     novi->veza=0;
  71.     lista=novi;
  72.   }while(a!=0);
  73.  
  74. ispisiListu(lista);
  75.  
  76. return 0;
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement