помогите найти ошибку в коде программы с++
#include "stdafx.h"
#include
#include
#include
#include
#include "time.h"
#include "iostream"

using namespace std;
class matrix
{
private:
int rows;
int cols;
int **arr = new int*[rows];
public:
void matrix1()
{
cin >> rows;
cin >> cols;
for (int i = 0; i < rows; i++)
{
arr[i] = new int[cols];
}
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < cols; j++)
{
arr[i][j] = rand() % 10;
}
}
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < cols; j++)
{
cout << arr[i][j] << "\t";
}
cout << endl;
}

for (int i = 0; i < rows; i++)
{
delete[] arr[i];
}
delete[] arr;
}
};
void main()
{
srand(time(NULL));
matrix pervaya;
pervaya.matrix1();
system("pause");
}
Please enter comments
Please enter your name.
Please enter the correct email address.
You must agree before submitting.

Answers & Comments


Copyright © 2024 SCHOLAR.TIPS - All rights reserved.