Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- int main()
- {
- try
- {
- int n;
- std::cout<<"Koliko elemenata?";
- std::cin>>n;
- if (n<0) throw (n);
- try
- {
- int *niz(new int[n]);
- for(int i(0); i<n; i++)
- niz[i]=0;
- for(int i(0); i<n; i++)
- cout << niz[i];
- delete [] niz;
- }
- catch(...)
- {
- std::cout<<"Alokacija nije uspjela";
- }
- }
- catch(int e)
- {
- std::cout<<"Broj ne moze biti manji od nule";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement