Предмет: Информатика, автор: ilfirukfluger

Напишите код на С++ плиз​

Приложения:

RCAXAPO4EK: код на С++ плиз
RCAXAPO4EK: всё написалъ

Ответы

Автор ответа: Аноним
1

#include <iostream>

#include <iomanip> // setw

#include <random> // rand srand

#include <ctime> // time

using namespace std;

int main() {

   srand(time(0)); // сид для случайных чисел

   int n;

   cin >> n;

   int arr[n][n];

   for(int i = 0; i<n; ++i) {

       bool f = 0;

       for(int j = 0; j<n; ++j) {

           if(i == j) {

               f = 1;

           }

           if(!f || i == j) { // заполняем всё, что над диагональю единицами

               arr[j][i] = 1;

           } else {

               arr[j][i] = rand() % 7 + 1;

           }

       }

   }

   for(int i = 0; i<n; ++i) { // вывод массива в консоль

       for(int j = 0; j<n; ++j) {

           cout << arr[i][j] << setw(5);

       }

       cout << " | " << 1;

       cout << endl;

   }

   return 0;

}

Не особо понимаю задание "вывести минимальное значение по строкам", т. к. оно всегда равно 1.


Аноним: Забыл про вторую часть задания, сейчас добавлю.
Похожие вопросы
Предмет: Английский язык, автор: Аноним
помогите пожалуиста

надо выбрать глаголы TO BE TO HAVE

There _______ two windows in this classroom.
Where _______ the athletes yesterday morning
You _______ a student next year.
The students of our group _______ in a sports camp last week.
Nick takes up hockey. He _______ a hockey stick.
I _______ training sessions at a modern sports centre last year.
I _____ got skates.
________ she got a dictionary?
A runner ______ got strong legs
Our Academy ______ its own sports facilities.
Mike is a first year student. He _______ examinations twice a year.
Ted _______ running shoes
I ______ got a large family.
I ______ the first grade.
There ______ an indoor stadium in our Academy.
I _______ an instructor.
Nick _______ a coach next year.
There _______ an ice-rink in our town.
There _______ three Masters of Sports in this group last year.
We ______ students.
Our Academy _______ in Moscow.
There _______ no tennis courts in my town.
How many students _______ there in your group?
It _______ Friday yesterday.
_______ she got a swimming suit?
Lis goes in for tennis. She _______ a tennis racket.
This sports centre ______ got a swimming pool.
He _______ the last training session two days ago.
Each University ______ its own stadium.
There ______ many sport complexes in Moscow
There ______ a map of Great Britain on the wall.
There ______ no tennis courts in my city last year.
Tom began to practice wrestling when he ______ 14 years old.
There ______ many sports complexes in our city.
There _______ some English dictionaries on my table.
This swimming suit ______ very good.
Mike is a first year student. He _______ examinations twice a year.
Tom ______ got a higher education.
Ted _______ running shoes.
We ______ a test last week.
They ______ training sessions three times a week.
______ you got any English books?
This sports centre ______ got a swimming pool.
The examination ______ not difficult
Three years ago he ______ a boxer.

Предмет: Алгебра, автор: maxtv9