--- C# 7.3 ---
using System;
using System.Collections.Generic;
using System.Linq;
namespace CSLear
{
class Program
private const int stdRow = 5;
private const int stdCols = 6;
static void Main(string[] args)
int[,] Arr = new int[stdRow, stdCols];
ArrayRandomize(ref Arr, stdRow, stdCols);
RemoveFirstRow(ref Arr, stdRow, stdCols);
Console.ReadKey();
}
public static void RemoveFirstRow<T>(ref T[,] Matr, int ArrRows, int ArrCols)
T[,] Temp = new T[ArrRows-1,ArrCols];
for (int i = 1; i < ArrRows; i++)
for (int j = 0; j < ArrCols; j++)
Temp[i - 1, j] = Matr[i, j];
Matr = Temp;
public static void ArrayRandomize(ref int[,] Arr, int ArrRows, int ArrCols)
Random r = new Random();
for (int i = 0; i < ArrRows; i++)
Arr[i, j] = r.Next(-99, 99);
Объяснение:
clrscr;
s:=0;
writeln('Vvedite tovarooborot po vidam:');
for i:=1 to 4 do
begin
write(x[i],'=');
readln(y[i]);
s:=s+y[i];
end;
y[i]:=y[i]*100/s;
dr:=detect;
initgraph(dr,mode,'');
xc:=GetMaxX div 2;
yc:=GetMaxY div 2;
outtextxy(Xc-80,20,'Tovarooborot po vidam, %');
b:=round(360*y[1]/100);
r:=150;
setcolor(10);
setfillstyle(1,11);
pieslice(xc,yc,0,b,r);
for i:=2 to 3 do
a:=round(360*y[i]/100)+b;
setcolor(10+i);
setfillstyle(1,10+i);
pieslice(xc,yc,a,b,r);
b:=a;
setcolor(14);
setfillstyle(1,14);
pieslice(xc,yc,b,360,r);
setcolor(i+10);
setfillstyle(1,i+10);
bar(xc+150,i*40,xc+180,i*40+20);
setcolor(15);
str(y[i]:0:2,st);
outtextXY(xc+190,i*40+5,x[i]+'-'+s
--- C# 7.3 ---
using System;
using System.Collections.Generic;
using System.Linq;
namespace CSLear
{
class Program
{
private const int stdRow = 5;
private const int stdCols = 6;
static void Main(string[] args)
{
int[,] Arr = new int[stdRow, stdCols];
ArrayRandomize(ref Arr, stdRow, stdCols);
RemoveFirstRow(ref Arr, stdRow, stdCols);
Console.ReadKey();
}
public static void RemoveFirstRow<T>(ref T[,] Matr, int ArrRows, int ArrCols)
{
T[,] Temp = new T[ArrRows-1,ArrCols];
for (int i = 1; i < ArrRows; i++)
{
for (int j = 0; j < ArrCols; j++)
{
Temp[i - 1, j] = Matr[i, j];
}
}
Matr = Temp;
}
public static void ArrayRandomize(ref int[,] Arr, int ArrRows, int ArrCols)
{
Random r = new Random();
for (int i = 0; i < ArrRows; i++)
{
for (int j = 0; j < ArrCols; j++)
{
Arr[i, j] = r.Next(-99, 99);
}
}
}
}
}
Объяснение:
Объяснение:
clrscr;
s:=0;
writeln('Vvedite tovarooborot po vidam:');
for i:=1 to 4 do
begin
write(x[i],'=');
readln(y[i]);
s:=s+y[i];
end;
for i:=1 to 4 do
y[i]:=y[i]*100/s;
dr:=detect;
initgraph(dr,mode,'');
xc:=GetMaxX div 2;
yc:=GetMaxY div 2;
outtextxy(Xc-80,20,'Tovarooborot po vidam, %');
b:=round(360*y[1]/100);
r:=150;
setcolor(10);
setfillstyle(1,11);
pieslice(xc,yc,0,b,r);
for i:=2 to 3 do
begin
a:=round(360*y[i]/100)+b;
setcolor(10+i);
setfillstyle(1,10+i);
pieslice(xc,yc,a,b,r);
b:=a;
end;
setcolor(14);
setfillstyle(1,14);
pieslice(xc,yc,b,360,r);
for i:=1 to 4 do
begin
setcolor(i+10);
setfillstyle(1,i+10);
bar(xc+150,i*40,xc+180,i*40+20);
setcolor(15);
str(y[i]:0:2,st);
outtextXY(xc+190,i*40+5,x[i]+'-'+s