Advertisement
daniv1

Untitled

Apr 4th, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 2.38 KB | None | 0 0
  1. program lab4;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. uses  sysutils,
  6.   {$IFDEF UNIX}{$IFDEF UseCThreads}
  7.   cthreads,
  8.   {$ENDIF}{$ENDIF}
  9.   Classes
  10.   { you can add units after this };
  11.  
  12. Type Bus = class (TObject)
  13.  
  14.     private
  15.       name , number , route , carbrand ,year , AutoMileage :string;
  16.       public
  17.      Constructor Create();
  18.       Procedure SetDriver(s : string);
  19.       procedure setNumber(s :string);
  20.       procedure setRoute(s :string);
  21.       procedure setCarBrand(s :string);
  22.       procedure setYear(s :string);
  23.       procedure setAutoMileage(s :string);
  24.   end;
  25.    Constructor Bus.Create;
  26.    begin
  27.  
  28.    end;
  29.          Procedure Bus.setDriver ( s:string ) ;
  30.   begin
  31.  
  32.   name :=s;
  33.   end;
  34.  
  35.     Procedure Bus.setNumber ( s:string ) ;
  36.   begin
  37.  
  38.   number :=s;
  39.   end;
  40.  
  41.     Procedure Bus.setroute ( s:string ) ;
  42.   begin
  43.  
  44.   route :=s;
  45.   end;
  46.     Procedure Bus.setcarBrand ( s:string ) ;
  47.   begin
  48.  
  49.   carbrand :=s;
  50.   end;
  51.     Procedure Bus.setyear ( s:string ) ;
  52.   begin
  53.  
  54.   year :=s;
  55.   end;
  56.     Procedure Bus.setAutoMileage ( s:string ) ;
  57.   begin
  58.  
  59.   automileage :=s;
  60.   end;
  61.  
  62. Function IntToStr (I : Integer) : String;
  63.  
  64. Var S : String;
  65.  
  66. begin
  67. Str (I,S);
  68. IntToStr:=S;
  69. end;
  70. Var
  71.  bus1  : array [ 0..100] of Bus;
  72.  marN , busNumb , years , race :String;
  73.  i ,marNInt, busNumbInt , yearsInt , raceInt , routenumber: Integer;
  74. begin
  75. routenumber:= 1002;
  76.      for i:= 0 to 100 do
  77.           begin
  78.             bus1[i]:=bus.create() ;
  79.             marN:=IntToStr(i + 1000);
  80.             bus1[i].setRoute(marN);
  81.             busNumb:=IntToStr(i + 10000);
  82.             bus1[i].setNumber(busNumb);
  83.             years:=IntToStr(i);
  84.             bus1[i].setYear(years);
  85.             race:=IntToStr(i + 9970);
  86.             bus1[i].setAutoMileage(race);
  87.           end;
  88.  
  89.      for i:= 0 to 100 do
  90.           begin
  91.              marNInt :=StrToInt(Bus1[i].route);
  92.              busNumbInt :=StrToInt(Bus1[i].number);
  93.              yearsInt :=StrToInt(Bus1[i].year);
  94.              raceInt :=StrToInt(Bus1[i].AutoMileage);
  95.              if(routenumber = marNInt) then
  96.              begin
  97.              writeln(busNumbInt);
  98.              end;
  99.  
  100.  
  101.               if(yearsInt > 10) then
  102.              begin
  103.              writeln(busNumbInt);
  104.              end;
  105.  
  106.               if(raceInt >10000) then
  107.              begin
  108.              writeln(busNumbInt);
  109.              end;
  110.  
  111.  
  112.           end;
  113.  
  114.  
  115. Readln;
  116. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement