• Дан двумерный массив 6*7, заполнить [-4;12] и заменить элементы стоящие в нечёт. строках единицей

Ответы 1

  • #include <iostream>using std::cout;using std::endl;#include <cstdlib>using std::rand;using std::srand;#include <ctime>using std::time;#include <iomanip>using std::setw;int main(){    int a[6][7];    srand(time(0));    for(int i = 0; i < 6; i++)    {        for(int j = 0; j < 7; j++)        {            a[i][j] = rand() % 17 - 4;            cout << setw(2) << a[i][j] << ' ';        }        cout << endl;    }    cout << endl;    for(int i = 1; i < 6; i += 2)    {        for(int j = 0; j < 7; j++)        {            a[i][j] = 1;        }    }    for(int i = 0; i < 6; i++)    {        for(int j = 0; j < 7; j++)        {            cout << setw(2) << a[i][j] << ' ';        }        cout << endl;    }    cout << endl;    return 0;}

    answer img
    • Автор:

      honey9
    • 6 лет назад
    • 0
  • Добавить свой ответ

Войти через Google

или

Забыли пароль?

У меня нет аккаунта, я хочу Зарегистрироваться

How much to ban the user?
1 hour 1 day 100 years