Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program laba_11_v6;
- {$APPTYPE CONSOLE}
- {$R *.res}
- uses
- System.SysUtils, Generics.Collections;
- type TTv = record
- Company: string;
- Diagonal: Integer;
- Cost: Integer;
- end;
- Pointer = ^TTv;
- Var
- txt:TextFile;
- Info: TList<TTv>;
- smth, enc: TTv;
- s: String;
- ss: TArray<string>;
- split: TArray<String>;
- count, i: Integer;
- myPoint: Pointer;
- begin
- Info:= TList<TTv>.Create;
- count:= 0;
- AssignFile(txt, 'E:\Downloads\cmp.txt.txt');
- Reset(txt);
- while not Eof(txt) do
- begin
- ReadLn(txt, s);
- split:= s.Split(['-']);
- with myPoint^ do
- begin
- myPoint^.Company:= split[0];
- myPoint^.Diagonal:= StrToInt(split[1]);
- myPoint^.Cost:= StrToInt(split[2]);
- end;
- Info.Add(myPoint^);
- end;
- CloseFile(txt);
- for enc in Info do
- begin
- with myPoint^ do
- begin
- if ((myPoint^.Company = 'Samsung') and (myPoint^.Diagonal > 32)) then
- begin
- Inc(count);
- end;
- end;
- end;
- Writeln('Найдено ', count,' телевизоров Samsung с диагональю больше 32 д.');
- Readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement