This document provides an introduction to computer programming concepts and languages. It discusses how computers work, basic computer hardware components, memory, binary numbers, programming languages like C and MATLAB. The document also explains the structure of a C program, the processes of compiling, linking and executing a program.
Download as PPT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
45 views
By: Assoc. Prof. Dr. Mohd Shafiek Yaacob
This document provides an introduction to computer programming concepts and languages. It discusses how computers work, basic computer hardware components, memory, binary numbers, programming languages like C and MATLAB. The document also explains the structure of a C program, the processes of compiling, linking and executing a program.
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 11
|
by: Assoc. Prof. Dr. Mohd Shafiek Yaacob °|
his course formally introduces the concept of
Ô °omputers, algorithms, problem solving, and programming languages. Ô he two programming languages introduced in this course are ° and MA AB. °
By the end of the course, the students should be able
to : Ô develop programming concept, flow chart and algorithm for solving a given computational process. Ô write an appropriate ° program for solving a given engineering problem. Ô write an appropriate MA AB program for solving a given engineering problem Ô generate a graphical solution and representation of a given engineering problem °
Ô A computer is a machine that stores information, and
can perform mathematical computations at great speed. Ô A program, which is stored in computer¶s memory, is a group of instructions that tells the computer what sequence of computations are required and on which information to perform the computations. Ô When a program is executed , a set of information called the input data is processed to produced the desired results known as the output data. G
G°
Ô °entral Processing Unit (°PU)
- Arithmetic logic unit - °ontrol unit - Internal memory Ô Input/Output devices Ô Main memory Ô Secondary memory
°
Ô °omputer memories are composed of millions of
individual switches, each of which can be ON or OFF. Ô Each switch represents one binary digit (also called a bit). Ô A byte is a group of 8 bits that are grouped to represent a binary number. Ô A larger grouping of bits is called a word.
Most of the time, the fact that computers work with
binary numbers is irrelevant to the programmer. (Give one example of the simplest computer) °
Ô °omputer executes a program/operations in simple
binary pattern, called operation code (op code). Ô Op codes are collectively called machine language. Ô Programmers like to program with high-level languages: - Basic - Pascal - Fortran - °/° - MA AB - Java
°
Ô ° is a general-purpose, structured programming
language. Ô ° resembles other high-level programming languages, and it also allows low-level programming. Ô ° has relatively small instruction set, but include extensive library functions. Ô ° compilers are usually compact, and ° interpreters are becoming increasingly common. Ô ° programs are highly portable. | °
Ô Every ° program consists of one or more modules
called Ounctions. Ô One of the function must be called Ô Ô Each function must contain: - A function r ading - A list of argument d clarations - A compound stat m nt Ô Each compound statement is enclosed by Ô Each expression statement must end with a X Ô °omments are placed within the delimiters D and D °
Ô Before a program can be executed, it must be
compiled into an object code with a compiler. Ô hen the object code must be linked with the computer¶s system libraries to produce an executable program. Ô he detail of compiling and linking are different for every compiler and operating system.