Advertisement
alexpetro000

Untitled

Dec 27th, 2015
418
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <stdio.h>
  3.  
  4. using namespace std;
  5.  
  6. //prog5
  7. int main()
  8. {
  9.     freopen("input.txt", "r", stdin);
  10.     freopen("output.txt", "w", stdout);
  11.  
  12.     const int N = 6;
  13.     int mas1[N], mas2[N];
  14.     int c=0;
  15.  
  16.     for(int i=0; i<N; i++)
  17.        cin>>mas1[i];
  18.  
  19.     for(int i=0; i<N; i++){
  20.        if(mas1[i] > 0) {
  21.             mas2[c]=mas1[i];
  22.             c++;
  23.         }
  24.     }
  25.     for(int i=0; i<c; i++){
  26.        cout<<mas2[i]<<' ';
  27.    }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement