Presentation is loading. Please wait.

Presentation is loading. Please wait.

PASCAL PROGRAMMING MAIN BODY OF PROGRAM u DECLARATION u ACTION.

Similar presentations


Presentation on theme: "PASCAL PROGRAMMING MAIN BODY OF PROGRAM u DECLARATION u ACTION."— Presentation transcript:

1 PASCAL PROGRAMMING MAIN BODY OF PROGRAM u DECLARATION u ACTION

2 DECLARATIONS u CONST u TYPE u VAR u PROCEDURE u FUNCTION

3 EXAMPLE Program Example; uses dos,crt; const A = 10; Book = ‘Kitap’; Good = true; Bad = false; MsgHelp = ‘Yardım için F1 tuşu’; Days : array[1..7] of String[5] = (‘Mon’, ‘Tues’,’Wed’,’Thurs’,’Fri’,’Sat’,’Sun’);

4 type Isimler = array[1..100] of String[20]; Names = Isimler; SurNames = Isimler; Name = String[20]; ArrayValues = array[1..500] of Real; Student= Record Isim : Name; Soyad: Name; Age: Integer; end;

5 var Talebeler : Isimler; x,y: ArrayValues ; k: Notlar; B: array[1..200] of real; C: array[1..10] of char; Kelime: String[20];

6 program Alan; var A: Real; I: Integer; procedure ComputeArea(x,y:Real ; var Area : Real ; var N : Integer); begin Writeln(‘How many significant digits after decimal ?’); Read(N); Area := x * y; end; begin ComputeArea(5,5,A,I); Writeln(‘Area = ‘,A:3:I); end.

7 program Alan; var A: Real; I: Integer; procedure ComputeArea(x,y:Real); begin Writeln(‘How many significant digits after decimal ?’); Read(I); A := x * y; end; begin ComputeArea(5,5); Writeln(‘Area = ‘,A:3:I); end.

8 program Alan; uses unit1; begin ComputeArea(5,5); Writeln(‘Area = ‘,A:3:I); end.

9 unit unit1; interface var A: Real; I: Integer; procedure ComputeArea(x,y:Real); implementation procedure ComputeArea; begin Writeln(‘How many significant digits after decimal ?’); Read(I); A := x * y; end; end.

10 STATEMENTS SIMPLE STATEMENTS STRUCTURED STATEMENTS SIMPLE STATEMENTS X := y * z + w/v -u; Name := ‘Demir’; Sentence := ‘ This is a sentence’; BunuYaz(‘This is a sentence’); Satir := Line(1);

11 STRUCTURED STATEMENTS IF then begin statement1; statement2;true. end else begin statements;false end;

12 STRUCTURED STATEMENTS case of {case 1} : begin end; {case2}:begin end; end else begin end;

13 while do begin end; repeat begin end; until ;

14 for I :=n to m do begin end; this can also be from m to n where m>n


Download ppt "PASCAL PROGRAMMING MAIN BODY OF PROGRAM u DECLARATION u ACTION."

Similar presentations


Ads by Google