Advertisement
Guest User

mire

a guest
Oct 16th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. // ConsoleApplication8.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6.  
  7. using namespace std;
  8.  
  9. struct let
  10. {
  11. char* nazivLeta;
  12. let* sljedeci;
  13. };
  14.  
  15. void DodajNaPocetakListe(char _nazivLeta[], let* lista)
  16. {
  17. let* temp = new let;
  18.  
  19. temp->nazivLeta = new char[strlen(_nazivLeta) + 1];
  20. strcpy_s(temp->nazivLeta, strlen(_nazivLeta) + 1, _nazivLeta);
  21.  
  22. temp->sljedeci = lista;
  23. lista = temp;
  24. }
  25.  
  26. void IspisListe(let* lista)
  27. {
  28. if (lista == nullptr)return;
  29.  
  30. cout << lista->nazivLeta;
  31.  
  32. IspisListe(lista->sljedeci);
  33. }
  34.  
  35. int main()
  36. {
  37. let* lista = nullptr;
  38.  
  39. DodajNaPocetakListe("Sarajevo", lista);
  40.  
  41. IspisListe(lista);
  42.  
  43. system("pause");
  44.  
  45. return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement