Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- #define CLS system("cls")
- class Matrix {
- private:
- public:
- int rows, collons;
- int** data;
- void create() {
- data = new int*[rows];
- for (int i = 0; i < rows; i++)
- {
- data[i] = new int[collons];
- }
- }
- Matrix(int r, int c) :rows(r), collons(c) { create(); }
- void ShowMatrix() {
- for (int i = 0; i < rows; i++) {
- cout << "|" ;
- for (int j = 0; j < collons; j++) {
- cout.width(4);
- cout << data[i][j];;
- }
- cout<< "|" << endl;
- }
- }
- void fillMatrix() {
- for (int i = 0; i < rows; i++) {
- for (int j = 0; j < collons; j++)
- data[i][j] = rand() % 11;
- }
- }
- };
- int main() {
- Matrix SuperMatrix(3, 3);
- SuperMatrix.fillMatrix();
- SuperMatrix.ShowMatrix();
- system("pause");
- //spasibo isusu
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement