Paskal Dil Karşılaştırması Aslı Ergün
Veri Türleri Pseudocode Pascal/Delphi C++ Integer Floating point Boolean Character String Single, Real, Double Char 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; text1: string; c: Real; // c: Single; veya c: Double; d: Boolean; Year: Integer; begin a := 'H'; text1 := 'Hello World!'; c := 4.5; d := True; Year := 2017; end
Fonksiyon Tanımlama Pseudocode Pascal/Delphi C++ Name Statement/s END PROCEDURE Name(parameter if any); BEGIN Statement/s ; END; FUNCTION Name(parameter if any): datatype; statement/s; Name := returnValue; or RESULT := returnValue; void Name(parameter if any); { } ; datatype Name(parameter if any) return value; };
Değişken ve Sabit Tanımlama Pseudocode Pascal/Delphi C++ Variable Declaration VAR variableName1,...:datatype; datatype variableName1, ... ; CONSTNAME = value CONST CONSTNAME = value; const datatype CONSTNAME = value;
Değer Atama Pseudocode Pascal/Delphi C++ SET variableName TO value or variableName = value variableName := value ; variableName = value ;
Mantık Operatörleri Pseudocode Pascal/Delphi C++ operand = operand operand NOT = operand operand < operand operand > operand operand <= operand (operand = operand) (operand <> operand) (operand < operand) (operand > operand) (operand <= operand) (operand == operand) (operand != operand)
Mantık bağlaçları Pseudocode Pascal/Delphi C++ operand AND operand operand OR operand operand NOT operand NOT (operand) (operand && operand) (operand || operand) ! (operand)
IF ELSE karar yapısı Pseudocode Pascal/Delphi C++ IF (condition) THEN True statement/s block ELSE False statement/s block ENDIF BEGIN True statement/s block; END False statement/s block; END; if (condition) { } else };
Switch karar yapısı Pseudocode Pascal/Delphi C++ 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 CASE single_variable OF value_1 : statement block_1; value_2 : statement block_2; value_n : statement block_n; ELSE statement block_other; END; SWITCH (single_variable) { case value_1 : statement/s ; break; case value_2 : statement/s; case value_n : statement/s; default: statement/s; };
DO WHILE döngüsü Pseudocode Pascal/Delphi C++ DO statement/s WHILE (condition) REPEAT statement/s; UNTIL NOT (condition); do { } while (condition); DOWHILE (condition) ENDDO WHILE (condition) DO BEGIN END; while (condition) };
Repeat döngüsü Pseudocode Pascal/Delphi C++ REPEAT statement/s UNTIL (condition) statement/s; UNTIL (condition); do { } while !(condition);
FOR döngüsü Pseudocode Pascal/Delphi C++ DO counter = begin TO end statement/s ENDDO FOR counter := begin TO end DO BEGIN statement/s; END; for (counter = begin; counter <= end; counter++) { };
Kayıtlar(Records) Pseudocode Pascal/Delphi C++ Record structures recordName fieldname1 fieldname2 ... fieldnameN TYPE recordName = RECORD field1 : datatype; field2 : datatype; .... fieldN: datatype; END; struct recordNameType { datatype field1; datatype field2; datatype fieldN; };
Diziler(Arrays) Pseudocode Pascal/Delphi C++ Declaring arrays One-dimensional SET arrayName(maxNumElements) VAR arrayName : ARRAY[begin .. end] OF datatype; datatype arrayName [maxNumElements]; Two-dimensional SET arrayName (row, column) arrayName : ARRAY[begin ..maxrow, begin..maxcolumn] OF datatype; [row][columns]; Processing Array Elements Assigning a value arrayName (index) = value Reading a value variableName = arrayName (index) arrayName [index] := value; variableName := arrayName [index]; arrayName [index] = value ; variableName = arrayName [index];