Program Massive;
uses Crt;
const
K = 3;
L = 6;
var
Z: array [1..K * L] of integer;
R: array [1..K * L] of integer;
Q: array [1..K * L] of integer;
i: integer;
x: integer;
begin
Randomize;
x := K * L;
for i:= 1 to x do
Z[i] := Random(20);
R[i] := Random(10);
end;
ClrScr;
writeln('Massive Z:');
write(Z[i]:4);
writeln;
writeln('Massive R:');
write(R[i]:4);
Q[i]:= Z[i] * R[i] + 10;
writeln('Massive Q:');
write (Q[i]:4);
readln
end.
#include "stdafx.h" #include <conio.h> #define N 3 typedef struct { char name[25]; int tel[15]; int bday[3]; } NOTE; void setValue(NOTE blockNote[N]); void printValue(NOTE blockNote[N]); int _tmain(int argc, _TCHAR* argv[]) { NOTE blockNote[N]; setValue(blockNote); printValue(blockNote); return 0; } void setValue(NOTE blockNote[N]) { for(int i=0; i<N; i++) { printf("Enter name: "); gets_s(blockNote[i].name); printf("Enter tel: "); printf("%d", &blockNote[i].tel); printf("Enter bday (format: day.month.year): "); scanf_s("%d.%d.%d", &blockNote[i].bday[0], &blockNote[i].bday[1], &blockNote[i].bday[2]); printf("---\n"); } } void printValue(NOTE blockNote[N]) { for(int i=0; i<N; i++) printf("name: %s tel: %d bday: %d.%d.%d\n", blockNote[i].name, blockNote[i].tel, blockNote[i].bday[0], blockNote[i].bday[1], blockNote[i].bday[2]); }
Program Massive;
uses Crt;
const
K = 3;
L = 6;
var
Z: array [1..K * L] of integer;
R: array [1..K * L] of integer;
Q: array [1..K * L] of integer;
i: integer;
x: integer;
begin
Randomize;
x := K * L;
for i:= 1 to x do
begin
Z[i] := Random(20);
R[i] := Random(10);
end;
ClrScr;
writeln('Massive Z:');
for i:= 1 to x do
write(Z[i]:4);
writeln;
writeln('Massive R:');
for i:= 1 to x do
write(R[i]:4);
writeln;
for i:= 1 to x do
Q[i]:= Z[i] * R[i] + 10;
writeln('Massive Q:');
for i:= 1 to x do
write (Q[i]:4);
readln
end.
#include "stdafx.h" #include <conio.h> #define N 3 typedef struct { char name[25]; int tel[15]; int bday[3]; } NOTE; void setValue(NOTE blockNote[N]); void printValue(NOTE blockNote[N]); int _tmain(int argc, _TCHAR* argv[]) { NOTE blockNote[N]; setValue(blockNote); printValue(blockNote); return 0; } void setValue(NOTE blockNote[N]) { for(int i=0; i<N; i++) { printf("Enter name: "); gets_s(blockNote[i].name); printf("Enter tel: "); printf("%d", &blockNote[i].tel); printf("Enter bday (format: day.month.year): "); scanf_s("%d.%d.%d", &blockNote[i].bday[0], &blockNote[i].bday[1], &blockNote[i].bday[2]); printf("---\n"); } } void printValue(NOTE blockNote[N]) { for(int i=0; i<N; i++) printf("name: %s tel: %d bday: %d.%d.%d\n", blockNote[i].name, blockNote[i].tel, blockNote[i].bday[0], blockNote[i].bday[1], blockNote[i].bday[2]); }