Program calculate sum of tree matrix
Delphi & Pascal (česká wiki)
Category: KMP (Club of young programmers)
Author: Ján Benkovič
web: www.tbteacher.host.sk
Program: Matice.pas
File exe: Matice.exe
Author: Ján Benkovič
web: www.tbteacher.host.sk
Program: Matice.pas
File exe: Matice.exe
Program calculate sum of tree matrix. Request 3 matrix with MxN and write mutual sum.
{ MATICE.PAS Copyright (c) Jan Benkovic } { Program na sucet dvoch matic. } { Vyziada si 3 matice o rozmeroch MxN a vypise ich vzajomny sucet. } { } { Datum:04.02.2000 http://www.trsek.com } program Vypocet_matice_pomocou_pola; uses crt; Type pole=array[1..10,1..10] of integer; var A,B,C,D : pole; I,J,M,N : integer; procedure CITAJ (var POM : pole); begin for I:= 1 to M do for J:= 1 to N do begin Writeln('Zadaj ',J,' prvok v ',I,' riadku '); Readln(POM[I,J]); end; end; procedure VYPIS (POM : pole); begin for I:= 1 to M do Writeln(POM[I,J]); Writeln; end; procedure SUCET (POM1,POM2 : pole; var POM : pole); begin for I:= 1 to M do for J:= 1 to N do POM[I,J]:=POM1[I,J]+POM2[I,J]; end; begin clrscr; Writeln('Zadaj pocet riadkov v matici '); Readln(M); Writeln('Zadaj pocet stlpcov v matici '); Readln(N); Writeln('Zadaj prvky I. matice '); CITAJ(A); Writeln('Zadaj prvky II. matice '); CITAJ(B); Writeln('Zadaj prvky III. matice '); CITAJ(C); readkey; delay(1000); clrscr; Writeln('I. matica '); VYPIS(A); Writeln('II. matica '); VYPIS(B); Writeln('II. matica '); VYPIS(C); Writeln('Sucet I. a II. matice '); SUCET(A,B,D); VYPIS(D); Writeln('Sucet I. a III. matice '); SUCET(A,C,D); VYPIS(D); Writeln('Sucet II. a III. matice '); SUCET(B,C,D); VYPIS(D); readkey; end.