Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2020
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. #include <iostream>
  2. #include <bits/stdc++.h>
  3.  
  4. using namespace std;
  5. int random(int a,int b);
  6. int main(){
  7.  
  8. int dcp, min, max, b ;
  9. cout<<"Введите размер массива строк: ";
  10. cin>>dcp;
  11. cout<<"Введите размер массива столбцов: ";
  12. cin>>b;
  13. cout<<"Введите min диапозона: ";
  14. cin>>min;
  15. cout<<"Введите max диапозона: ";
  16. cin>>max;
  17. // b = dcp;
  18. double** mas = new double* [dcp];
  19.  
  20. double* minElemnt = new double [dcp];
  21. double* maxElemnt = new double [dcp];
  22.  
  23. for (int i = 0; i < b; i++) {
  24. minElemnt[i] = max + 1;
  25. maxElemnt[i] = min - 1;
  26. }
  27.  
  28. for (int i = 0; i < dcp; i++)
  29. {
  30. mas[i] = new double[b];
  31. }
  32.  
  33. for (int i = 0; i < dcp; i++)
  34. {
  35.  
  36. for (int j = 0; j < b; j++)
  37. {
  38. /*if (min > 0)*/
  39. mas[i][j]=min + rand() % (max - min);
  40. //else mas[i][j]=min + rand() % (abs(min) + max);
  41. cout<<setw(3);
  42. cout<<setprecision(6)<<mas[i][j]<<" ";
  43.  
  44. if (mas[i][j] < minElemnt[j]) {
  45. minElemnt[j] = mas[i][j];
  46. }
  47.  
  48. if(mas[i][j] > maxElemnt[j]) {
  49. maxElemnt[j] = mas[i][j];
  50. }
  51. }
  52. cout<<endl;
  53. }
  54.  
  55. for (int i = 0; i < b; i++) {
  56. cout << setw(3) << minElemnt[i] + maxElemnt[i] << " ";
  57. }
  58. cout<<endl;
  59.  
  60. for (int i = 0; i < b; i++) {
  61. cout << setw(3) << minElemnt[i]<< " ";
  62. }
  63. cout<<endl;
  64.  
  65. for (int i = 0; i < b; i++) {
  66. cout << setw(3) << maxElemnt[i] << " ";
  67. }
  68. cout<<endl;
  69.  
  70. double pi = 3.1415926536;
  71.  
  72. std::cout << std::setprecision(2) << std::fixed << pi << std::endl;
  73. std::cout << std::setprecision(2) << std::scientific << pi << std::endl;
  74.  
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement