Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void vektor()
- {
- int MAX;
- int *niz;
- cout << "Unesi velicinu niza" <<endl;
- cin >> MAX;
- if (MAX>0)
- {
- niz = new int [MAX];
- for(int i=0;i<MAX;cout <<niz[i++]<<endl);
- }
- delete[] niz;
- }
- void viseDimNiz()
- {
- int BROJ_VRSTA;
- int BROJ_KOLONA;
- int **a;
- cout << "Unesi velicinu vrsta" <<endl;
- cin >> BROJ_VRSTA;
- cout << "Unesi velicinu kolona" <<endl;
- cin >> BROJ_KOLONA;
- if (BROJ_VRSTA>0 && BROJ_KOLONA>0)
- {
- a = new int *[BROJ_VRSTA];
- for (int i=0;i<BROJ_VRSTA;i++)
- {
- a[i]= new int [BROJ_KOLONA];
- }
- }
- }
- int main()
- {
- int a[10];
- a[0]=111111;
- a[1]=222222;
- a[2]=333333;
- for(int i=0;i<15;i++) /**< nizovi nemaju prave granice */
- cout <<a[i]<<endl;
- cout << "" << endl;
- cout << a<< "\n" << endl;
- cout << *(a +1) << endl; //aritmetika pokazivaca
- int* b =a+1;
- cout << b[0] << "\n"<< endl;
- int c[]={100,200,300};
- for (int i=0;i<5;i++)
- cout <<c[i]<<endl;
- /**< for (int i=0;i<3;cout <<c[i++]<<endl); */
- cout << "" << endl;
- vektor();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement