Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include "time.h"
- #include "rgz17.h"
- using namespace std;
- int main()
- {
- setlocale(0, "Rus");
- double a[6][6],vibor;
- cout<<"\tРГЗ по курсу Информатики"<<endl;
- cout<<"\tВариант №17."<<endl;
- cout<<"\tВыполнил Фамилия Имя,"<<endl;
- cout<<"\tСтудент группы РС-91"<<endl;
- cout<<endl;
- do
- {
- cout<<"Введите:"<<endl;
- cout<<"1) Для задачи матрицы случайчными числами"<<endl;
- cout<<"2) Для ввода матрицы с клавиатуры"<<endl;
- cout<<"3) Для поиска максимального отрицательного числа"<<endl;
- cout<<"4) Для уменьшения элементов побочной диагонали в 2 раза"<<endl;
- cout<<endl;
- cout<<"Выберите пункт меню:\n";
- cin >> vibor;
- cout<<endl;
- cout<<endl;
- cout<<endl;
- if (vibor==1)
- {
- random(a);
- vivod(a);
- cout<<endl;
- cout<<endl;
- cout<<endl;
- }
- if (vibor==2)
- {
- cout<<"Введите матрицу из 36 элементов"<<endl;
- klava(a);
- cout<<endl;
- vivod(a);
- cout<<endl;
- cout<<endl;
- cout<<endl;
- }
- if (vibor==3)
- {
- vivod(a);
- maxelement(a);
- cout<<endl;
- cout<<"Максимальный отрицательный элемент в Матрице А= "<<maxelement(a)<<endl;
- cout<<endl;
- cout<<endl;
- cout<<endl;
- }
- if (vibor==4)
- {
- vivod(a);
- cout<<endl;
- cout<<endl;
- cout<<endl;
- cout<<"Измененная матрица:"<<endl;
- cout<<endl;
- umenshenie(a);
- vivod(a);
- cout<<endl;
- cout<<endl;
- cout<<endl;
- }
- }while (vibor>=1 && vibor<=4);
- return 0;
- }
- #include "stdafx.h"
- #include <iostream>
- #include <math.h>
- #include "rgz17.h"
- using namespace std;
- void random(double a[6][6])
- {
- int i,j;
- for (i=0;i<6;i++)
- {
- for (j=0;j<6;j++)
- {
- a[i][j]=-100+rand()%200;
- }
- }
- }
- void klava(double a[6][6])
- {
- int i,j;
- for( i=0;i<6;i++)
- {
- for (j=0;j<6;j++)
- {
- cin>>a[i][j];
- }
- }
- }
- int maxelement(double a[6][6])
- {
- int max=-300000, i, j;
- for (i=0;i<6;i++)
- {
- for (j=0;j<6;j++)
- {
- if (a[i][j]>max && a[i][j]<0)
- max=a[i][j];
- }
- }
- return (max);
- }
- void umenshenie( double a[6][6])
- {
- int i,j=5;
- for (i=0;i<6;i++)
- {
- a[i][j]=a[i][j]/2;
- j--;
- }
- }
- void vivod(double a[6][6])
- {
- int i,j;
- cout<<"Матрица A"<<endl;
- for (i=0;i<6;i++)
- {
- for (j=0;j<6;j++)
- {
- cout<< a[i][j]<<"\t";
- }
- cout << endl;
- }
- }
- #ifndef rgz17_H
- #define rgz17_H
- void random(double a[6][6]);
- void klava(double a[6][6]);
- int maxelement(double a[6][6]);
- void umenshenie( double a[6][6]);
- void vivod(double a[6][6]);
- #endif /*rgz17_H*/
Advertisement
Add Comment
Please, Sign In to add comment