Guest User

Untitled

a guest
Jan 18th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. pair <int, int> find(int n, int *a){
  5. pair <int, int> x;
  6. x.first = -1;
  7. x.second = -1;
  8. for(int i = 0; i < n; ++i)
  9. if(a[i] == 0)
  10. if(x.first == -1) x.first = i;
  11. else{
  12. x.second = i;
  13. return x;
  14. }
  15. return x;
  16. }
  17.  
  18. int main()
  19. {
  20. int *a = new int [10];
  21. int n,k,i,j,pr=1,iCount = 0;
  22. pair <int, int> x;
  23. cout<<"vvedite razmer massiva:";
  24. cin>>n;
  25. cout<<"vvedite massiv ";
  26. for(i=0;i<n;i++)
  27. cin>>a[i];
  28. x = find(n, a);
  29.  
  30. if (x.first == -1 || x.second == -1)
  31. cout << "There are no two zero\n";
  32. else{
  33. for(i = x.first+1; i < x.second; ++i)
  34. pr *= a[i];
  35. cout << pr;}
  36.  
  37.  
  38. return 0;
  39. }
Add Comment
Please, Sign In to add comment