Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include "time.h"
- #include "rgz12.h"
- using namespace std;
- int main()
- {
- setlocale(0, "Rus");
- double a[6][6],rez;
- cout<<"\tРГЗ по курсу Информатики"<<endl;
- cout<<"\tВариант №12."<<endl;
- cout<<"\tВыполнил Михалев Данил,"<<endl;
- cout<<"\tСтудент группы РС-92"<<endl;
- cout<<endl;
- do
- {
- cout<<"Введите:"<<endl;
- cout<<"1) Для задачи матрицы случайчными числами"<<endl;
- cout<<"2) Для ввода матрицы с клавиатуры"<<endl;
- cout<<"3) Для поиска количества отрицательных элементов побочной диагонали матрицы"<<endl;
- cout<<"4) Для увеличения элементов главной диагонали на 6"<<endl;
- cout<<endl;
- cout<<"Выберите пункт меню:\n";
- cin >> rez;
- cout<<endl;
- cout<<endl;
- cout<<endl;
- if (rez==1)
- {
- random(a);
- vivod(a);
- cout<<endl;
- cout<<endl;
- cout<<endl;
- }
- if (rez==2)
- {
- cout<<"Введите матрицу из 36 элементов"<<endl;
- klava(a);
- cout<<endl;
- vivod(a);
- cout<<endl;
- cout<<endl;
- cout<<endl;
- }
- if (rez==3)
- {
- vivod(a);
- kolotrpob(a);
- cout<<endl;
- cout<<"Количество отрицательных элементов в побочной диагонали в Матрице А= "<<kolotrpob(a)<<endl;
- cout<<endl;
- cout<<endl;
- cout<<endl;
- }
- if (rez==4)
- {
- vivod(a);
- cout<<endl;
- cout<<endl;
- cout<<endl;
- cout<<"Измененная матрица:"<<endl;
- cout<<endl;
- yvelglav(a);
- vivod(a);
- cout<<endl;
- cout<<endl;
- cout<<endl;
- }
- }while (rez>=1 && rez<=4);
- return 0;
- }
- #include "stdafx.h"
- #include <iostream>
- #include <math.h>
- #include "rgz12.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];
- }
- }
- }
- double kolotrpob(double a[6][6])
- {
- int i, j=5, kol=0;
- for (i=0;i<6;i++)
- {
- if (a[i][j]<0)
- kol++;
- j--;
- }
- return (kol);
- }
- void yvelglav( double a[6][6])
- {
- int i;
- for (i=0;i<6;i++)
- {
- a[i][i]=a[i][i]+6;
- }
- }
- 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 rgz12_H
- #define rgz12_H
- void random(double a[6][6]);
- void klava(double a[6][6]);
- double kolotrpob(double a[6][6]);
- void yvelglav( double a[6][6]);
- void vivod(double a[6][6]);
- #endif /*rgz12_H*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement