program P1;
uses
crt;
var
A : array[1..3] of array [1..4] of longint;
i,j : integer;
begin
clrscr;
randomize;
writeln('Massiv : ');
for i := 1 to 3 do
begin
writeln('');
for j := 1 to 4 do
begin
A[i][j] := random(15)+random(5)-random(5);
write(A[i][j]:2,' ');
end;
end;
for i := 1 to 3 do
for j := 1 to 4 do
begin
if A[i][j] > 10 then
A[i][j] := i - j;
if (A[i][j] >= -5) and (A[i][j] <= 5) then
A[i][j] := sqr(i);
end;
writeln('');
writeln('');
writeln('Itogoviy massiv : ');
for i := 1 to 3 do
begin
writeln('');
for j := 1 to 4 do
begin
write(A[i][j]:2,' ');
end;
end;
readln;
readln;
end.
#include <iostream>
#include<stdlib.h>
/*
В прямоугольной целочисельной матрице упорядочить элементы, которые размещены на главной диагонале по убыванию
*/
using namespace std;
int main() {
setlocale(LC_ALL,"rus");
cout << "Masiv do sortirovki "<< endl << endl;
int mas[5][5];
for(int i=0; i<5; i++){
for(int j=0; j<5; j++){
mas[i][j]=-10+rand()%90;
cout<<mas[i][j]<<" ";
}
cout << endl;
}
cout << endl << endl;
cout << "Masiv posle sortirovki "<< endl << endl;
/* сортировку тут нужно провести */
for(int i=0; i<5; i++){
for(int j=0; j<5; j++){
cout<<mas[i][j]<<" ";
}
cout << endl;
}
cout << endl << endl;
return 0;
сорри если не правильно.(
Поделитесь своими знаниями, ответьте на вопрос:
Вмассиве хранятся сведения о стоимости товаров, проданных фирмой за каждый день марта. определить количество дней, в которые стоимость проданных товаров превысила значение s.
#include "math.h"
using namespace std;
int main()
{
float s, a[30], day=0; //объявление переменных
cin>>s; //ввод S
for(int i=0; i<30; i++) //заполнение массива случайными числами
{
a[i]=rand();
}
for(int i=0; i<30; i++)//подсчет количества дней
{
if(a[i]>s)
{
day++;
}
}
cout<<"Kolichestvo dney: "<<day<<endl; // вывод количества дней
system("pause");
return 0;
}