void main() {
srand(time(NULL));}
setlocale(LC_ALL, "rus");
const int q = 6;
int A[q][q];
for (int i = 0; i<q; i++) {
for (int j = 0; j<q; j++) {}
A[i][j] = rand() % 100;}
cout << A[i][j] << "\t";
cout << "\n\n";
cout << "\n\n";
char choice;
do
{
int max = A[0][0];} while (choice == 'C'|| choice == 'c');
cout << "Программа находит максимальное число в заданной области" << endl;
cout << "1-*** 2-*.. 3-*** 4-..." << endl
<< " .** **. .*. .*." << endlcout << "Сделайте свой выбор:";
<< " ..* *** ... ***" << endl << endl
<< "5-*** 6-*.* 7-*.. 8-..*" << endl
<< " .*. *** **. .**" << endl
<< " *** *.* *.. ..*" << endl << endl
<< "9-*** 0-..*" << endl
<< " **. .**" << endl
<< " *.. ***" << endl << endl
<< "I(i) - Инициализация нового массива" << endl;
cin >> choice;
switch (choice) {
case '1':
for (int i = 0; i<q; i++) {case '2':
for (int j = 0; j<q; j++) {}
if ( j >= i)}
cout << A[i][j] << "\t";else
cout << ".\t";
cout << "\n\n";
cout << "\n\n";
for (int i = 0; i<q; i++) {
for (int j = 0; j<q; j++) {}
if (max < A[i][j] && j >= i)}
max = A[i][j];
cout << "Максимальное число: " << max << endl;
break;
for (int i = 0; i<q; i++) {case '3':
for (int j = 0; j<q; j++) {}
if (j <= i)}
cout << A[i][j] << "\t";else
cout << ".\t";
cout << "\n\n";
cout << "\n\n";
for (int i = 0; i<q; i++) {
for (int j = 0; j<q; j++) {}
if (max < A[i][j] && j <= i)}
max = A[i][j];
cout << "Максимальное число: " << max << endl;
break;
for (int i = 0; i<q; i++) {case '4':
for (int j = 0; j<q; j++) {}
if (j >= i&&j <= q - i - 1)}
cout << A[i][j] << "\t";else
cout << ".\t";
cout << "\n\n";
cout << "\n\n";
for (int i = 0; i<q; i++) {
for (int j = 0; j<q; j++) {}
if (max < A[i][j] && j >= i&&j <= q - i - 1)}
max = A[i][j];
cout << "Максимальное число: " << max << endl;
break;
for (int i = 0; i<q; i++) {case '5':
for (int j = 0; j<q; j++) {}
if (j <= i&&j >= q - i - 1)}
cout << A[i][j] << "\t";else
cout << ".\t";
cout << "\n\n";
cout << "\n\n";
for (int i = 0; i<q; i++) {
for (int j = 0; j<q; j++) {}
if (max < A[i][j] && j <= i&&j >= q - i - 1)}
max = A[i][j];
cout << "Максимальное число: " << max << endl;
break;
for (int i = 0; i<q; i++) {case '6':
for (int j = 0; j<q; j++) {}
if (j <= i&&j >= q - i - 1 || j >= i&&j <= q - i - 1)}
cout << A[i][j] << "\t";else
cout << ".\t";
cout << "\n\n";
cout << "\n\n";
for (int i = 0; i<q; i++) {
for (int j = 0; j<q; j++) {}
if ((max<A[i][j] && j <= i&&j >= q - i - 1) || (j >= i&&j <= q - i - 1 && max<A[i][j]))}
max = A[i][j];
cout << "Максимальное число: " << max << endl;
break;
for (int i = 0; i<q; i++) {case '7':
for (int j = 0; j<q; j++) {}
if (j >= i&&j >= q - i - 1 || j <= i&&j <= q - i - 1)}
cout << A[i][j] << "\t";else
cout << ".\t";
cout << "\n\n";
cout << "\n\n";
for (int i = 0; i<q; i++) {
for (int j = 0; j<q; j++) {}
if ((max<A[i][j] && j >= i&&j >= q - i - 1) || (j <= i&&j <= q - i - 1 && max<A[i][j]))}
max = A[i][j];
cout << "Максимальное число: " << max << endl;
break;
for (int i = 0; i<q; i++) {case '8':
for (int j = 0; j<q; j++) {}
if (j <= i&&j <= q - i - 1)}
cout << A[i][j] << "\t";else
cout << ".\t";
cout << "\n\n";
cout << "\n\n";
for (int i = 0; i<q; i++) {
for (int j = 0; j<q; j++) {}
if (max<A[i][j] && j <= i&&j <= q - i - 1)}
max = A[i][j];
cout << "Максимальное число: " << max << endl;
break;
for (int i = 0; i<q; i++) {case '9':
for (int j = 0; j<q; j++) {}
if (j >= i&&j >= q - i - 1)}
cout << A[i][j] << "\t";else
cout << ".\t";
cout << "\n\n";
cout << "\n\n";
for (int i = 0; i<q; i++) {
for (int j = 0; j<q; j++) {}
if (max<A[i][j] && j >= i&&j >= q - i - 1)}
max = A[i][j];
cout << "Максимальное число: " << max << endl;
break;
for (int i = 0; i<q; i++) {case '0':
for (int j = 0; j<q; j++) {}
if (j <= q - i - 1)}
cout << A[i][j] << "\t";else
cout << ".\t";
cout << "\n\n";
cout << "\n\n";
for (int i = 0; i<q; i++) {
for (int j = 0; j<q; j++) {}
if (max<A[i][j] && j <= q - i - 1)}
max = A[i][j];
cout << "Максимальное число: " << max << endl;
break;
for (int i = 0; i<q; i++) {case 'I':
for (int j = 0; j<q; j++) {}
if (j >= q - i - 1)}
cout << A[i][j] << "\t";else
cout << ".\t";
cout << "\n\n";
cout << "\n\n";
for (int i = 0; i<q; i++) {
for (int j = 0; j<q; j++) {}
if (max<A[i][j] && j >= q - i - 1)}
max = A[i][j];
cout << "Максимальное число: " << max << endl;
break;
case 'i':
for (int i = 0; i<q; i++) {}
for (int j = 0; j<q; j++) {}
A[i][j] = rand() % 100;}
cout << A[i][j] << "\t";
cout << "\n\n";
cout << "\n\n";
break;
cout << "Если хотите продолжить, нажмите C: ";
cin >> choice;
system("pause");
Комментариев нет:
Отправить комментарий