Advertisement
gasaichan

14 var

Apr 8th, 2018
368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. #include stdafx.h
  2. #include <iostream>
  3. #include <iomanip>
  4. #include <cmath>
  5. #include <time.h>
  6. #include <cstdlib>
  7. using namespace std;
  8. int main()
  9. {
  10. setlocale(LC_CTYPE,"Russian");
  11. srand((unsigned)time(NULL));
  12. const int n=25;
  13. double x[n],y[n];
  14. double p=1;
  15.  
  16. int A;
  17. cout << "Введите число A:";
  18. cin >> A;
  19. for(int i=0;i<n;i++) x[i]=rand()/100-100;
  20. cout<<"Массив X>";
  21. for(int i=0;i<n;i++)cout<<x[i]<<setw(10);
  22. cout<<endl;
  23. for(int i=0;i<n;i++) y[i]=rand()/100-100;
  24. cout<<"Массив Y>";
  25. for(int i=0;i<n;i++)cout<<y[i]<<setw(10);
  26. cout<<endl;
  27. for(int i=0;i<n;i++)
  28. if(abs(X[i] - Y[i]) > A) p *= abs(X[i] - Y[i]);
  29. cout<<"Произведение элементов массива Y = "<<p<<endl;
  30. return(0);
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement