Presentation is loading. Please wait.

Presentation is loading. Please wait.

Sha Tin Methodist College F.4 Computer Studies Pascal Programming.

Similar presentations


Presentation on theme: "Sha Tin Methodist College F.4 Computer Studies Pascal Programming."— Presentation transcript:

1 Sha Tin Methodist College F.4 Computer Studies Pascal Programming

2 Converting a character to ASCII code: e.g. ord(“char type”); Converting an ASCII code to character: e.g. chr(“integer type”); String Comparison 10. ASCII Table and String Comparison

3 11. String Manipulation The length of the string: e.g. length( “ string type ” ); Selecting a character from a string: e.g. a[n]

4 Selecting part of string: e.g. copy(string1, integer1,integer2); String concatenation: e.g. concat(string1, string2); or “ + ” 11. String Manipulation

5 Convert a number into a string: e.g. str( “ integer type ”, “ string type ” ); Convert a string into numeric form: e.g. val(string1, number1, error_postion); : end of line ( “ Enter ” ) 11. String Manipulation

6 12. Procedures Procedure is a group of statements which can be called from different parts in a program. Global and local variables Parameter passing

7 13. File Handling Steps in creating a new file: 1. Declare a file variable: e.g. var phone: text; 2. Assign the file variable with a file name: e.g. assign(phone, ‘ tele.txt ’ );

8 13. File Handling 3. Open the file for output: e.g. rewrite(phone); 4. Write to the file: e.g. writeln(phone, variable1, variable2 … ); 5. Close the file: e.g. close(phone);

9 13. File Handling Steps in reading a new file: Same as steps in creating a new file except step 3 and 4: reset(phone); readln(phone, variable1, variable2 … ); End of file consideration:

10 14. Two dimensional array Declaration of 2D array: e.g. var A: array[1..3, 1..4] of integer; Use 2 for loops

11 15. Sorting Bubble Sort No. of data No. of pass No. of compariso n at each pass Max. no. of swaping NN-1N-pass no.N*(N- 1)/2

12 15. Sorting Procedure “ Swap ” Use 2 for loops in the main program Merge Sort The Algorithm of the sorting


Download ppt "Sha Tin Methodist College F.4 Computer Studies Pascal Programming."

Similar presentations


Ads by Google