So far so good, you've helped me a lot guys. Really want to thank you. All your advice has helped me a lot through the next subjects.
But since I have these 'shiny' moments, I got stuck at an exercise i've been assigned for home.
So basically what I have to do is have an array , or how's it called , basically this :
type t=array [1..100] of integer;
(input - keyboard)
and I have to find the biggest sequence of zeroes (I have to input them myself, but the computer will compare the sequences (quantity of zeroes) and find out which sequence has the biggest quantity of all.), basically - let's say I introduce my numbers : 1,5,156,321,0 (here it starts counting),0,0,0,0,0,0,0,0,0,0,20(here it stops counting).. so the sequence here has
11 zeroes. Other one will have 9, other 20 blah blah blah and it will continue until I hit 100 values introduced.
THEN it will tell me which sequence has the biggest number of zeroes..
Here is my code if anyone is interested :
type t=array [1..100] of integer;
var
a:t;
n,i,nr1,nr2,secmax,sec1,sec:integer;
begin
writeln ('Introduce the number of elements');
readln (n);
for i:=1 to n do
begin
writeln ('Introduce the element nr.', ' ', i);
readln (a[i]);
end;
secmax:=sec1;
for i:=1 to n do
begin
if (a[i]=0) then
inc(nr1) else
end;
for i:=i to n do
begin
if (a[i]=0) then
inc(nr2) else
end;
if nr1>nr2 then nr1:=seci else nr2:=seci; // here I'm trying to use sec(i) as sec1,sec2,sec3 so that 'i' will always increase so I compare new values, instead of using the old ones..
if (seci>secmax) then secmax:=seci;
Your help would be really appreciated as I'm really stuck here and idk what to write.
Thanks in advance!
-Aerowei