ערכתי לאחרונה בתאריך 21.01.04 בשעה 18:53 בברכה, SpyCop
עשיתי את זה הרגע אז זה יכול להיות טיפה מסורבל בחלק מהקטעים, מצטער שלא השתמשתי בפרוצדורות, פשוט לא מצאתי צורך בהם.אז הקוד:
program binary;
const
n = 10;
type
arr = array {1..n} of integer;
var
a:arr;
count,max,i,sidra:integer;
begin
for i:= 1 to n do
begin
writeln('Enter Value Number',' ', i);
readln(a{i});
end;
max:= 0;
count:= 0;
for i:= 1 to n do
begin
if (a{i} = 1) then
begin
Count:= Count + 1;
if (max < count) then
max:= count;
end
else
begin
Count:= 0;
if (a{i-1} = 1) then
sidra:= sidra + 1;
end;
end;
if (a{n} = 1) then
sidra:= sidra + 1;
writeln;
writeln('The Max Length of one string is',' ',max);
writeln('There Are',' ',sidra,' ','strings of one');
readln;
end.
תחליף את כל הסוגריים המסולסלים בתוכנית בסוגריים מרובעיםבמקרה הזה עשיתי ש n שווה ל10 אבל אתה יכול לשנות את זה לפי איך שאתה רוצה.....
אם אתה צריך הסבר........אז אני מוכן להסביר.