[go: up one dir, main page]

0% found this document useful (0 votes)
20 views18 pages

Chapter 1.1-1.3 Introduction

Uploaded by

hazlindaidris
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views18 pages

Chapter 1.1-1.3 Introduction

Uploaded by

hazlindaidris
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

DEC 20012

Programming
Fundamental
CHAPTER 1:
INTRODUCTORY TO PROGRAMMING
Notes 1.1

By : MOHD AZRAL FAUZI

1
1.1: Remember The Programming Language

How human and computer interact :

2
1.1: Remember The Programming Language

Programming Language
Definition:
• A set of rules and reserved words
(keywords) that can be used to tell a
computer what are the operations to be
done.
• Artificial language composed by a fixed
vocabulary and set of rules is used to create
instructions for the computer to follow.

3
1.1: Remember The Programming Language

Background of C Programming

⮚ It was originally developed by Dennis M. Ritchie to developed the


UNIX operating system at Bell Labs.
⮚ Developed at AT&T’s Bell Laboratories of USA in 1972 and
originally first implemented on the DEC PDP-11 computer.
⮚ The UNIX operating system, the C compiler, and the essentially all
UNIX application programs have been written in C.
⮚ C Become a widely used because:
-easy to learn
- Structured language
-It produces efficient programs
- It can handle low-level activities
- It can be compiled on a variety of computer platforms.
4
1.1: Remember The Programming Language
Sample of C Program: Printing a line of text
1 /* Fig. 2.1: fig02_01.c
2 A first program in C */
3 #include <stdio.h>
4
5 int main()
6 {
7 printf( "Welcome to C!\n" );
8
9 return 0;
10 }

Welcome to C!

• Comments
– Text surrounded by /* and */ is ignored by computer
– Used to describe program

5
1.1: Remember The Programming Language

• #include <stdio.h>
- Preprocessor directive
- Tells computer to load contents of a certain file
- <stdio.h> allows standard input/output operations

• int main()
– C++ programs contain one or more functions, exactly one
of which must be main
– Parenthesis used to indicate a function
– int means that main "returns" an integer value
– Braces ({ and }) indicate a block
The bodies of all functions must be contained in braces
6
1.1: Remember The Programming Language

• printf( "Welcome to C!\n" );


– Instructs computer to perform an action
• Specifically, prints the string of characters within
quotes (“ ”)
– Entire line called a statement
• All statements must end with a semicolon (;)
– Escape character (\)
• Indicates that printf should do something
out of the ordinary
• \n is the newline character
7
1.1: Remember The Programming Language

• return 0;
– A way to exit a function
– return 0, in this case, means that the
program terminated normally

• Right brace }
– Indicates end of main has been reached

8
1.1: Remember The Programming Language

Sample of C Program : Adding three numbers


Example 1
Write a program that can accept a three integer data entered by the user. Get the average number and finally
show the numbers and average numbers

9
1.1: Know The Programming Language
Sample of C Program
Example 2
The pseudo code below is to find the volume of a box if the length, width and height are given. Write the
program based on the pseudo code below.

10
DEC 20012
Programming
Fundamental
CHAPTER 1:
INTRODUCTORY TO PROGRAMMING
Notes 1.2

By : MOHD AZRAL FAUZI

11
1.2: Remember Definition and Types of Programming

⚫Programme : A computer program is a


sequence of instructions written to perform
a specified task for a computer.

12
1.2: Remember Definition and Types of Programming

⚫Programmer : is someone who writes


computer software. The term computer
programmer can refer to a specialist in one
area of computer programming or to a
generalist who writes code for many kinds of
software.

13
1.2: Remember Definition and Types of Programming

⚫A programming language is a notation for writing


programs, which are specifications of a
computation or algorithm.
⚫A programming language is an artificial language
designed to express computations that can be
performed by a machine, particularly a computer.
⚫Programming languages can be used to create
programs that control the behavior of a machine,
to express algorithms precisely, or as a mode of
human communication.

14
1.3 : Types of Programming and Structure Programming
Methodology

🞆 Structured programs are often composed of


simple, hierarchical program flow structures.
These are sequence, selection, and repetition.

15
1.3 : Types of Programming and Structure Programming
Methodology

🞆 Modular programming is subdividing the


program into separate subprograms such as
functions and subroutines.

🞆 Subprograms make your actual program shorter,


hence easier to read and understand.
1.3 : Types of Programming and Structure Programming
Methodology

🞆 Object Oriented Programming is type of


programming in which programmers define not
only the data type of a data structure, but also the
types of operations (functions) that can be
applied to the data structure.

🞆 The data structure becomes an object that


includes both data and functions.

17
Thank You!!

18

You might also like