tutotveti.ru
Предметы
Биология
Українська мова
Музыка
Французский язык
Физика
МХК
Обществознание
Психология
ОБЖ
Право
Беларуская мова
Литература
Химия
Українська література
Экономика
Немецкий язык
География
Информатика
Қазақ тiлi
Геометрия
Английский язык
Русский язык
Окружающий мир
Алгебра
История
Другие предметы
Видео-ответы
ПОИСК
Войти
Регистрация
Информатика
Си++ дана матрица размером
Си++ дана матрица размером nстрок и mстолбцов. найти количество положительных чисел в столбце.
panda312
1 09.06.2019 11:10
0
Ответы
shakurovagaliya
08.07.2020 08:22
#include<iostream>
#include<cstdlib>
#include<ctime>
#include<locale>
#include<windows.h>
using namespace std;
int main()
{
setlocale(LC_ALL, "Russian");
srand(time(NULL));
const int n=12, m=12;
int a[n][m];
int s = 0;
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
a[i][j] = rand() % 2;
if(a[i][j]) a[i][j] = rand()%100;
else a[i][j] = rand()%50*(-2);
cout << a[i][j] << ' ';
}
cout << '\n';
}
cout << '\n';
int c;
cout << "Введите номер столбца: ";
cin >> c;
for(int i=0; i < 12; i++)
if(a[i][c] > 0) s++;
cout << "Количество положительных чисел в столбце " << c << ": " << s << '\n';
system("pause");
}
ПОКАЗАТЬ ОТВЕТЫ
Другие вопросы по теме Информатика
Харпааа
31.07.2019 10:50
Некоторый алгоритм из одной цепочки десятичных цифр получает новую цепочку следующим образом. сначала вычисляется сумма всех цифр в цепочке. если сумма является нечетным числом,...
olka52
31.07.2019 10:50
Pascal abc. написать программу, чтобы построить график функции y=x2 на интервале [-3,3]...
natusestfons
31.07.2019 10:50
Pascal abc. ввести с клавиатуры число линий штриховки и построить произвольную фигуру (к примеру, квадрат), залив области разным цветом....
MUSHDAN
16.02.2022 15:02
Найдите сумму натуральных чисел а)кратных 4 и не превосходящих 900 б)кратных 3 и не превосходящих 800...
патишка1
16.02.2022 15:04
Идентификация результатов при работе с файлом Открывает файл в текстовом режиме Открывает предварительно созданный файл и записывает его, добавляя новые данные в конец записей...
маргарита00000000
16.02.2022 15:07
Для телефонных переговоров удовлетворительное качество получается при частоте дискретизации 8 кГц и частоте квантования 255 уровней. Сколько места потребуется на диске, чтобы...
Anna260
16.02.2022 15:07
Дано трехзначное число. Найти вторую цифру в записи числа....
masha1248
09.03.2021 19:08
Нужно перевести код из пайтона в паскаль АБС import math def f(x=0.0792,t=1.2,A=17,a=3.4,c=12.76): return ((x*(math.sin(t)+math.cos(a)))**(1/4))/(2.1*A*(c**6)**(3)+math.tanh(4))...
hudognik78
09.03.2021 19:08
Верно ли утверждение, что языки программирования высокого уровня ближе к человеческому пониманию и записывается в текстовом режиме? •верно•неверно 2. Определите тип данных переменнойа=31.5*•int...
гикат
04.10.2021 00:42
Сколько памяти на ноутбуке нужно освободить Артёму, чтобы перенести все свои файлы? Файлы: 1) «Мик и Рорти, S2E04», размер — 234 Мб 2) «Мик и Рорти, S2E05», размер — 248 Мб...
Популярные вопросы
ОЧЕНЬ Найди значение выражения (42)2...
3
Визначте масу солі, що утвориться при взаємодії 20 г сульфатної кислоти і...
3
Выбери предложение(я), в которых есть наречия. Частые метели также задерживали...
1
Назовите все свойства рациональных чисел для 6 класса...
2
Установите понятие сенат форум туника легион сенаторы марсово поле значение...
3
Отметьте, какие эстетические идеи характерны для импрессионизма. стремление...
1
Первые 120 километров пути авто проехал со скоростью 75 километров в час...
2
Иван мазепа уклав антироссийский союз из...
2
Углы и стороны треугольника. Даны величины углов треугольника ABC: ∡ A =...
3
Щығарманың 1-бөлімінің жанрын, стилін,тақырыбын, мазмұның идеясын ашады...
2
#include<cstdlib>
#include<ctime>
#include<locale>
#include<windows.h>
using namespace std;
int main()
{
setlocale(LC_ALL, "Russian");
srand(time(NULL));
const int n=12, m=12;
int a[n][m];
int s = 0;
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
a[i][j] = rand() % 2;
if(a[i][j]) a[i][j] = rand()%100;
else a[i][j] = rand()%50*(-2);
cout << a[i][j] << ' ';
}
cout << '\n';
}
cout << '\n';
int c;
cout << "Введите номер столбца: ";
cin >> c;
for(int i=0; i < 12; i++)
if(a[i][c] > 0) s++;
cout << "Количество положительных чисел в столбце " << c << ": " << s << '\n';
system("pause");
}