Created
November 1, 2019 15:02
-
-
Save leequixxx/eba0c2921820a16acfd2a506e30f3813 to your computer and use it in GitHub Desktop.
Лабараторная работа 3 (часть 2). Задание 9.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
program task329; | |
{$MODE DELPHI} | |
uses SysUtils; | |
var Numbers: array of integer; | |
var Index: integer; | |
var Count: integer; | |
begin | |
Index := 0; | |
while true do | |
begin | |
while true do | |
begin | |
try | |
SetLength(Numbers, Index + 1); | |
Write('Please, enter #', Index + 1, ' value (or 0 for exit): '); | |
ReadLn(Numbers[Index]); | |
Break; | |
except | |
on E: Exception do | |
begin | |
WriteLn('Value should be a number!'); | |
Continue; | |
end; | |
end; | |
end; | |
if Numbers[Index] = 0 then Break; | |
Index := Index + 1; | |
end; | |
Count := 0; | |
for Index := 1 to Length(Numbers) -1 do | |
begin | |
if Numbers[Index] = Numbers[Index - 1] then Count := Count + 1; | |
end; | |
WriteLn('Count: ', Count); | |
WriteLn('Enter something for exit...'); | |
ReadLn; | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment