Advertisement
Guest User

Untitled

a guest
Dec 16th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.97 KB | None | 0 0
  1. #include "iostream"
  2. #include <ctime>
  3. using namespace std;
  4.  
  5. void odin(){
  6.     int n = 50;
  7.     double a[50];
  8.     for (int i = 0; i < n; i++) {
  9.         a[i] = -30 + rand() % 60;
  10.         cout << a[i] << "  ";
  11.     }
  12.     cout << endl;
  13.  
  14.     double m = a[0];
  15.     int spalilsya;
  16.  
  17.     for (int i = 0; i < n; i++)
  18.         if (a[i] < m) {
  19.             m = a[i];
  20.             spalilsya = i;
  21.         }
  22.     for (int i = 0; i < n; i++)
  23.         if (a[i] == m) {
  24.             m = a[i];
  25.             spalilsya = i;
  26.             cout << m << " na " << i+1 << " meste"<<endl;
  27.         }
  28. }
  29.  
  30. void dva(double m, int n, int q) {
  31.  
  32.     srand(time(0));
  33.     double *a = new double[n];
  34.  
  35.     for (int i = 0; i < n; i++) {
  36.         a[i] = -q + rand()%(2*q)  + m;
  37.         cout << a[i] << "  ";
  38.     }
  39.     cout << endl;
  40. }
  41. void tri(int m, int q) {
  42.  
  43.     srand(time(0));
  44.     double **a = new double*[m];
  45.     for (int i = 0; i < m; i++) {
  46.         a[i] = new double[q];
  47.         for (int j = 0; j < q; j++) {
  48.             a[i][j] = 100 + rand() % 99;
  49.             cout << a[i][j] << "  ";
  50.         }
  51.         cout << endl;
  52.     }
  53.     cout << endl;
  54. }
  55. void chetire() {
  56.     //ne ponyatno zadanie
  57. }
  58.  
  59. void main() {
  60.     tri(10, 10);
  61.     system("pause");
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement