Paskal Dil Karlatrmas Asl Ergn Veri Trleri Pseudocode

  • Slides: 15
Download presentation
Paskal Dil Karşılaştırması Aslı Ergün

Paskal Dil Karşılaştırması Aslı Ergün

Veri Türleri Pseudocode Pascal/Delphi Integer Floating point Boolean Character String Integer Single, Real, Double

Veri Türleri Pseudocode Pascal/Delphi Integer Floating point Boolean Character String Integer Single, Real, Double Boolean Char String C++ int, long float, double bool char string -2, 147, 483, 648 to 2, 147, 483, 647 (4 byte) 5. 0 x 10^-324 to 1. 7 x 10^308 (8 byte) True/False (1 bit) ASCII karakter, 1 byte

Veri Türleri var a: char; text 1: string; c: Real; // c: Single; veya

Veri Türleri var a: char; text 1: string; c: Real; // c: Single; veya c: Double; d: Boolean; Year: Integer; begin a : = 'H'; text 1 : = 'Hello World!'; c : = 4. 5; d : = True; Year : = 2017; end

Fonksiyon Tanımlama Pseudocode Name Statement/s END Pascal/Delphi C++ PROCEDURE Name(parameter if any); BEGIN Statement/s

Fonksiyon Tanımlama Pseudocode Name Statement/s END Pascal/Delphi C++ PROCEDURE Name(parameter if any); BEGIN Statement/s ; END; void Name(parameter if any); { statement/s; }; FUNCTION Name(parameter if any): datatype Name(parameter if any) { statement/s; return value; }; datatype; BEGIN statement/s; Name : = return. Value; or RESULT : = return. Value; END;

Değişken ve Sabit Tanımlama Pseudocode Pascal/Delphi C++ Variable Declaration VAR variable. Name 1, .

Değişken ve Sabit Tanımlama Pseudocode Pascal/Delphi C++ Variable Declaration VAR variable. Name 1, . . . : datatype; datatype variable. Name 1, . . . ; CONSTNAME = value; const datatype CONSTNAME = value;

Değer Atama Pseudocode Pascal/Delphi SET variable. Name TO value or variable. Name = value

Değer Atama Pseudocode Pascal/Delphi SET variable. Name TO value or variable. Name = value variable. Name : = value ; C++ variable. Name = value ;

Mantık Operatörleri Pseudocode operand = operand NOT = operand < operand > operand <=

Mantık Operatörleri Pseudocode operand = operand NOT = operand < operand > operand <= operand Pascal/Delphi (operand = operand) (operand <> operand) (operand < operand) (operand > operand) (operand <= operand) C++ (operand == operand) (operand != operand) (operand < operand) (operand > operand) (operand <= operand)

Mantık bağlaçları Pseudocode operand AND operand OR operand NOT operand Pascal/Delphi operand AND operand

Mantık bağlaçları Pseudocode operand AND operand OR operand NOT operand Pascal/Delphi operand AND operand OR operand NOT (operand) C++ (operand && operand) (operand || operand) ! (operand)

IF ELSE karar yapısı Pseudocode IF (condition) THEN True statement/s block ELSE False statement/s

IF ELSE karar yapısı Pseudocode IF (condition) THEN True statement/s block ELSE False statement/s block ENDIF Pascal/Delphi C++ IF (condition) THEN BEGIN True statement/s block; END if (condition) { True statement/s block; } ELSE else { BEGIN False statement/s block; END; False statement/s block; };

Switch karar yapısı Pseudocode Pascal/Delphi CASE OF single_variable value_1 : statement block_1 value_2 :

Switch karar yapısı Pseudocode Pascal/Delphi CASE OF single_variable value_1 : statement block_1 value_2 : statement block_2. . . value_n : statement block_n. . . value_other : statement block_other ENDCASE single_variable OF value_1 : statement block_1; value_2 : statement block_2; . . . value_n : statement block_n; ELSE statement block_other; END; C++ SWITCH (single_variable) { case value_1 : statement/s ; break; case value_2 : statement/s; break; . . . case value_n : statement/s; break; default: statement/s; };

DO WHILE döngüsü Pseudocode DO statement/s WHILE (condition) DOWHILE (condition) statement/s ENDDO Pascal/Delphi C++

DO WHILE döngüsü Pseudocode DO statement/s WHILE (condition) DOWHILE (condition) statement/s ENDDO Pascal/Delphi C++ REPEAT statement/s; UNTIL NOT (condition); do { statement/s; } while (condition); WHILE (condition) DO BEGIN while (condition) { statement/s; END; statement/s; };

Repeat döngüsü Pseudocode REPEAT statement/s UNTIL (condition) Pascal/Delphi REPEAT statement/s; UNTIL (condition); C++ do

Repeat döngüsü Pseudocode REPEAT statement/s UNTIL (condition) Pascal/Delphi REPEAT statement/s; UNTIL (condition); C++ do { statement/s; } while !(condition);

FOR döngüsü Pseudocode DO counter = begin TO end statement/s ENDDO Pascal/Delphi C++ FOR

FOR döngüsü Pseudocode DO counter = begin TO end statement/s ENDDO Pascal/Delphi C++ FOR counter : = begin TO end DO BEGIN statement/s; END; for (counter = begin; counter <= end; counter++) { statement/s; };

Kayıtlar(Records) Pseudocode Record structures record. Name fieldname 1 fieldname 2. . . fieldname. N

Kayıtlar(Records) Pseudocode Record structures record. Name fieldname 1 fieldname 2. . . fieldname. N Pascal/Delphi TYPE record. Name = RECORD field 1 : datatype; field 2 : datatype; . . field. N: datatype; END; C++ struct record. Name. Type { datatype field 1; datatype field 2; . . datatype field. N; };

Diziler(Arrays) Pseudocode Declaring arrays One-dimensional SET array. Name(max. Num. Elements) Declaring arrays Two-dimensional SET

Diziler(Arrays) Pseudocode Declaring arrays One-dimensional SET array. Name(max. Num. Elements) Declaring arrays Two-dimensional SET array. Name (row, column) Processing Array Elements Assigning a value array. Name (index) = value Reading a value variable. Name = array. Name (index) Pascal/Delphi C++ VAR array. Name : ARRAY[begin. . end] OF datatype; datatype array. Name [max. Num. Elements]; VAR array. Name : ARRAY[begin. . maxrow, begin. . maxcolumn] OF datatype; datatype array. Name [row][columns]; array. Name [index] : = value; array. Name [index] = value ; variable. Name : = array. Name [index]; variable. Name = array. Name [index];