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