Создать матрицу
Вот ,что я написал.Подскажите с условием.
setlocale(LC_ALL, "Russian");
//1//
int n;
cout << "Введите размер матрицы" << endl;
cin >> n;
int *A = new int[n*n];
for (int i = 0; i < n - 1; i++) {//Заполнил нулями
for (int j = 0; j < n - 1; j++)
A[i*j] = 0;
}

for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++)
if (......................) Условие???????????????
A[i*j]=1;
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++)
cout << A[i*j] << ' ';
cout << endl;
}

delete[]A;

system("pause");
return 0;
}
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.