Advertisement
LabiinfaCibGyti

rgz6

Dec 15th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.68 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include "time.h"
  4. #include "rgz6.h"
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     setlocale(0, "Rus");
  10.     double a[3][6],vibor;
  11.         cout<<"\tРГЗ по курсу Информатики"<<endl;
  12.         cout<<"\tВариант №6."<<endl;
  13.         cout<<"\tВыполнила Какой-то лох на Тёме,"<<endl;
  14.         cout<<"\tСтудент группы РС-92"<<endl;
  15.         cout<<endl;
  16.         do
  17.         {
  18.             cout<<"Введите:"<<endl;
  19.             cout<<"1) Для задачи матрицы случайчными числами"<<endl;
  20.             cout<<"2) Для ввода матрицы с клавиатуры"<<endl;
  21.             cout<<"3) Для поиска минимального отрицательного числа"<<endl;
  22.             cout<<"4) Для увеличения элементов первой строки на 20"<<endl;
  23.             cout<<endl;
  24.             cout<<"Выберите пункт меню:\n";
  25.             cin >> vibor;
  26.             cout<<endl;
  27.             cout<<endl;
  28.             cout<<endl;
  29.             if (vibor==1)
  30.             {
  31.                 random(a);
  32.                 vivod(a);
  33.                 cout<<endl;
  34.                 cout<<endl;
  35.                 cout<<endl;
  36.             }
  37.             if (vibor==2)
  38.             {
  39.                 cout<<"Введите матрицу из 18 элементов"<<endl;
  40.                 klava(a);
  41.                 cout<<endl;
  42.                 vivod(a);
  43.                 cout<<endl;
  44.                 cout<<endl;
  45.                 cout<<endl;
  46.             }
  47.             if (vibor==3)
  48.             {
  49.                 vivod(a);
  50.                 minelement(a);
  51.                 cout<<endl;
  52.                 cout<<"Минимальный отрицательный элемент в Матрице А= "<<minelement(a)<<endl;
  53.                 cout<<endl;
  54.                 cout<<endl;
  55.                 cout<<endl;
  56.             }
  57.             if (vibor==4)
  58.             {
  59.                 vivod(a);
  60.                 cout<<endl;
  61.                 cout<<endl;
  62.                 cout<<endl;
  63.                 cout<<"Измененная матрица:"<<endl;
  64.                 cout<<endl;
  65.                 uvelperstr(a);
  66.                 vivod(a);
  67.                 cout<<endl;
  68.                 cout<<endl;
  69.                 cout<<endl;
  70.             }
  71.         }while (vibor>=1 && vibor<=4);
  72.         return 0;
  73. }
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83. #include "stdafx.h"
  84. #include <iostream>
  85. #include <math.h>  
  86. #include "rgz6.h"
  87. using namespace std;
  88.  
  89. void random(double a[3][6])
  90. {
  91.     int i,j;
  92.     for (i=0;i<3;i++)
  93.     {
  94.         for (j=0;j<6;j++)
  95.         {
  96.             a[i][j]=-100+rand()%200;
  97.         }
  98.     }
  99. }
  100. void klava(double a[3][6])
  101. {
  102.     int i,j;
  103.     for( i=0;i<3;i++)
  104.     {
  105.         for (j=0;j<6;j++)
  106.         {
  107.             cin>>a[i][j];
  108.         }
  109.     }
  110. }
  111. int minelement(double a[3][6])
  112. {
  113.     int min=300000, i, j;
  114.     for (i=0;i<3;i++)
  115.     {
  116.         for (j=0;j<6;j++)
  117.         {
  118.             if (a[i][j]<min && a[i][j]<0)
  119.                 min=a[i][j];
  120.         }
  121.     }
  122. return (min);
  123. }
  124. void uvelperstr( double a[3][6])
  125. {
  126.     int j;
  127.     for (j=0;j<6;j++)
  128.     {
  129.         a[0][j]=a[0][j]+20;
  130.     }
  131. }
  132. void vivod(double a[3][6])
  133. {
  134.     int i,j;
  135.     cout<<"Матрица A"<<endl;
  136.     for (i=0;i<3;i++)
  137.     {
  138.         for (j=0;j<6;j++)
  139.         {
  140.             cout<< a[i][j]<<"\t";
  141.         }
  142.         cout << endl;
  143.     }
  144. }
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159. #ifndef rgz6_H
  160. #define rgz6_H
  161. void random(double a[3][6]);
  162. void klava(double a[3][6]);
  163. int minelement(double a[3][6]);
  164. void uvelperstr( double a[3][6]);
  165. void vivod(double a[3][6]);
  166. #endif /*rgz6_H*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement