Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- setlocale(LC_ALL, "Russian");
- int rows = 0;
- int cols = 0;
- cout << "Введите количество строк: ";
- cin >> rows;
- cout << "Введите количество столбцов: ";
- cin >> cols;
- if (int(rows) <= 0 || int(rows) > 20 || int(cols) <= 0 || int(cols) > 20)
- {
- cout << "Введены неверные значение" << endl;
- system("pause");
- return 0;
- }
- int **arr = new int*[rows];
- 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++) {
- cout << "строка # " << i + 1 << "\t";
- cout << "столбец # " << j + 1 << "= ";
- cin >> arr[i][j];
- }
- }
- for (int i = 0; i < rows; i++) {
- for (int j = 0; j < cols; j++) {
- cout << arr[i][j] << "\t";
- }
- cout << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement