Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program lab4;
- {$mode objfpc}{$H+}
- uses sysutils,
- {$IFDEF UNIX}{$IFDEF UseCThreads}
- cthreads,
- {$ENDIF}{$ENDIF}
- Classes
- { you can add units after this };
- Type Bus = class (TObject)
- private
- name , number , route , carbrand ,year , AutoMileage :string;
- public
- Constructor Create();
- Procedure SetDriver(s : string);
- procedure setNumber(s :string);
- procedure setRoute(s :string);
- procedure setCarBrand(s :string);
- procedure setYear(s :string);
- procedure setAutoMileage(s :string);
- end;
- Constructor Bus.Create;
- begin
- end;
- Procedure Bus.setDriver ( s:string ) ;
- begin
- name :=s;
- end;
- Procedure Bus.setNumber ( s:string ) ;
- begin
- number :=s;
- end;
- Procedure Bus.setroute ( s:string ) ;
- begin
- route :=s;
- end;
- Procedure Bus.setcarBrand ( s:string ) ;
- begin
- carbrand :=s;
- end;
- Procedure Bus.setyear ( s:string ) ;
- begin
- year :=s;
- end;
- Procedure Bus.setAutoMileage ( s:string ) ;
- begin
- automileage :=s;
- end;
- Function IntToStr (I : Integer) : String;
- Var S : String;
- begin
- Str (I,S);
- IntToStr:=S;
- end;
- Var
- bus1 : array [ 0..100] of Bus;
- marN , busNumb , years , race :String;
- i ,marNInt, busNumbInt , yearsInt , raceInt , routenumber: Integer;
- begin
- routenumber:= 1002;
- for i:= 0 to 100 do
- begin
- bus1[i]:=bus.create() ;
- marN:=IntToStr(i + 1000);
- bus1[i].setRoute(marN);
- busNumb:=IntToStr(i + 10000);
- bus1[i].setNumber(busNumb);
- years:=IntToStr(i);
- bus1[i].setYear(years);
- race:=IntToStr(i + 9970);
- bus1[i].setAutoMileage(race);
- end;
- for i:= 0 to 100 do
- begin
- marNInt :=StrToInt(Bus1[i].route);
- busNumbInt :=StrToInt(Bus1[i].number);
- yearsInt :=StrToInt(Bus1[i].year);
- raceInt :=StrToInt(Bus1[i].AutoMileage);
- if(routenumber = marNInt) then
- begin
- writeln(busNumbInt);
- end;
- if(yearsInt > 10) then
- begin
- writeln(busNumbInt);
- end;
- if(raceInt >10000) then
- begin
- writeln(busNumbInt);
- end;
- end;
- Readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement