Advertisement
evcamels

timp-4_var-13

Dec 17th, 2021
1,001
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4. int main(){
  5.     vector <int> a,b;
  6.     int n;
  7.     cout << "Введите размер массива: ";
  8.     cin >> n;
  9.     cout << "Задайте массив: ";
  10.     for(int i=0;i<n;i++){
  11.         int temp;
  12.         cin >> temp;
  13.         if(temp > 0){
  14.             b.push_back(i);
  15.         }
  16.     }
  17.     for(int i=0;i<b.size();i++){
  18.         cout << b[i] << " ";
  19.     }
  20.     cout << endl;
  21.     return 0;
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement