Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdio.h>
- #include <string.h>
- #include <math.h>
- #include <conio.h>
- using namespace std;
- class cheslo;
- class matr
- {
- private:
- int** x;
- int n, m;
- int i, j, min;
- public:
- matr() {};
- matr(int);
- void vvod();
- void vivod();
- void razmer();
- void sort();
- friend void sravnenie(matr* M, cheslo c);
- };
- class cheslo
- {
- private:
- int c;
- public:
- cheslo() { c = 0; };
- //cheslo(int);
- void vvch();
- void vivch();
- friend void sravnenie(matr* M, cheslo c);
- };
- //-----------------------------------------------------------—
- void cheslo::vvch()
- {
- cout << "Введите число " << endl;
- cin >> c;
- }
- //-----------------------------------------------------------—
- //-----------------------------------------------------------—
- void cheslo::vivch()
- {
- cout<<c<<endl;
- }
- //-----------------------------------------------------------—
- //-----------------------------------------------------------—
- void matr::razmer()
- {
- cout << "Введите размер матрици[n x m]: " << endl;
- cin >> n >> m;
- }
- //-----------------------------------------------------------—
- //-----------------------------------------------------------—
- void matr::vvod()
- {
- x = new int* [n];
- for (int i = 0; i < n; i++)
- x[i] = new int[m];
- cout << "Введите элементы масива:"<<endl;
- for (int i = 0; i < n; i++)
- for (int j = 0; j < m; j++)
- {
- cin>>x[i][j];
- }
- }
- //-----------------------------------------------------------—
- //-----------------------------------------------------------—
- void matr::vivod()
- {
- cout << "Матрица :"<<endl;
- for (int i = 0; i < n; i++)
- {
- for (int j = 0; j < m; j++)
- cout <<x[i][j]<<" ";
- cout <<endl;
- }
- }
- //-----------------------------------------------------------—
- //-----------------------------------------------------------—
- void matr::sort()
- {
- min = x[0][0];
- for (int i = 0; i < n; i++)
- for (int j = 0; j < m; j++)
- if (min > x[i][j])
- min = x[i][j];
- cout << min<<endl;
- }
- //-----------------------------------------------------------—
- //-----------------------------------------------------------—
- void sravnenie(matr* M, cheslo c)
- {
- /*int min = 0, c = 0;
- if (c. == c)
- cout << "равенство верно " << endl;
- else
- cout << "равенство неверно " << endl;*/
- }
- //-----------------------------------------------------------—
- int main()
- {
- setlocale(LC_ALL, "rus");
- matr a;
- cheslo ch;
- a.razmer();
- a.vvod();
- ch.vvch();
- ch.vivch();
- a.sort();
- a.vivod();
- sravnenie(&a, ch);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement