Advertisement
Barbara_

Untitled

Dec 13th, 2011
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.  
  9.    int n;
  10.  
  11.     cout << "Vnesi velikost polja: " << endl;
  12.     cin >> n;
  13.  
  14.     int *polje1=new int [n];
  15.  
  16. // polnjenje polja
  17.  
  18. for (int i=0; i<n; i++)
  19.     {
  20.        cin >> polje1[i];
  21.     }
  22.  
  23.     //izpis polja
  24.  
  25.     cout << "polje1: " << endl;
  26.     for (int i=0; i<n;i++)
  27.     {
  28.         cout << polje1[i] <<" ";
  29.     }
  30.  
  31.    cout << endl;
  32.  
  33.  
  34.     cout << "polje2: " << endl;
  35.     int *polje2=new int[n];
  36.     for (int i=0; i<n;i++){
  37.  
  38.     //polnjenje polja
  39.     if (polje2[i]%2==0)
  40.     {
  41.        if (n<0)
  42.        n=abs(n);
  43.  
  44.     }
  45.  
  46.  
  47.      // izpis polja
  48.  
  49.     cout << polje2[i] <<" ";
  50.  
  51. }
  52.    cout << endl;
  53.  
  54.    return 0;
  55. }
  56.  
  57.  
  58.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement