Advertisement
sellmmaahh

DinamickiNiz

Jul 28th, 2015
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. using namespace std;
  2.  
  3. template <typename Tip>
  4. Tip *KreirajNiz(int n, Tip c) {
  5.     try {
  6.         Tip *pok=nullptr;
  7.         pok=new Tip[n];
  8.         for (int i=0; i<n; i++)
  9.             pok[i]=c;
  10.         return pok;
  11.        
  12.         }
  13.         catch (bad_alloc) {
  14.             throw "Kreiranje nije uspjelo.";
  15.         }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement