Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1.0 2.0
Introduction To Programming
Basic C++ Program Program Control
3.0
4.0 5.0
6.0
PN NORHASLIZA BT MUHAMAD NOR
Program A set of step-by-step instructions that directs a computer to perform a specific task and to produce the required results. Programmer Programmer is a person who writes the program. Programming Language A set of rules and reserved words (keywords) that can be used to tell a computer what are the operations to be done. Now, there are over 200 programming languages in the world. For example: Cobol, Pascal, C, C++, and Fortran.
PROGRAM DESIGN
PROGRAM CODING
10
Executing Program
11
12
13
14
15
16
17
1.
Syntax Checking: Once the code is updated based on the preprocessing, the code can be checked for valid syntax. This includes things like checking for semicolons, matching braces, every "begin" has an "end", etc. This doesn't mean the code is correct, but it does determine whether the code can be turned into machine code as written. 2. Converting To Assembly: This step doesn't exist for all languages/compilers. Java, obviously, doesn't use this step. Some compilers may go straight to machine code. GCC supports various languages, so converting all programs to Assembly makes converting to machine code much easier.
18
3.
Converting to Machine Code: What counts as machine code varies somewhat. Java goes to byte code (.class files). GCC creates object files. This step creates a file that is PART of the final program. 4. Linking Machine Code Into An Executable: Frequently, functions that are used by a program are defined in separate files. Delphi uses components that are in a variety of different files (especially commercially sold components). C/C++ use a variety of libraries. Java often merges .class files into a .jar file. At this step, many linkers will do final checks to make sure all the required pieces, functions, components, etc have been accounted for.
19
ERRORS
Compile Time
Run Time
Logical
20
21
22
c. Logical Error
Logical errors - Errors that indicate the logic used when coding the program failed to solve the problem.
You do not get error messages with logic errors. Your only clue to the existence of logic errors is the production of wrong solutions.
23
ADDITIONAL !!!
Syntax errors - Errors in spelling and grammar.
You can use the compiler or interpreter to uncover syntax errors. You must have a good working knowledge of error messages to discover the cause of the error.