Hello everyone I am a first semester student of lic. in computer science and in my university they sent us to learn the languages in a self-taught way, until now we have seen pascal but they ordered us to learn c / c ++, we are currently working with modules and fixes, my problem is that I have had great problems implementing this last learned ac / c ++ then I will place a code with which I have had these difficulties:
program sumamatrices;
const
x =4;
type
tiparre= array [1..x,1..x] of integer;
var
a,b,c : tiparre;
Fi,Co: integer;
procedure limpiar (var a,b,c : tiparre);
begin
for Fi := 1 to x do
begin
for Co:= 1 to x do
begin
a[Fi,co]:= 0;
b[Fi,co]:= 0;
c[Fi,co]:= 0;
end;
end;
end;
procedure llenar (var a,b:tiparre);
begin
for Fi:= 1 to x do
begin
for Co:= 1 to x do
begin
writeln ('ingrese el valor de a en la posicion ',Fi,', ',Co);
readln(a[Fi,Co]);
writeln ('ingrese el valor de b en la posicion ',Fi,', ',Co);
readln(b[Fi,Co]);
end;
end;
end;
procedure sumar (var a,b,c: tiparre);
begin
for Fi:= 1 to x do
begin
for Co:= 1 to x do
begin
c[Fi,Co]:= a[Fi,Co] + b[Fi,Co];
writeln ('el valor de c en la posicion',Fi,',',Co,'es ', c[Fi,Co]);
end;
end;
end;
procedure determinar (a:tiparre);
var
cont: integer;
begin
cont:=0;
for Co := 1 to x do
begin
if a[Fi,Co] = 1 then
begin
cont:= cont +1
end;
end;
if (cont = x) then
begin
writeln('la diagonal de a es 1');
end;
end;
begin
limpiar (a,b,c);
llenar (a,b);
sumar (a,b,c);
determinar(a);
end.
If any of you have the knowledge and the disposition to do me the favor of translating this code I would be very grateful, it would really help me a lot to understand this language