Chapter 1.1-1.3 Introduction
Chapter 1.1-1.3 Introduction
Programming
Fundamental
CHAPTER 1:
INTRODUCTORY TO PROGRAMMING
Notes 1.1
1
1.1: Remember The Programming Language
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
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
• 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
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
11
1.2: Remember Definition and Types of Programming
12
1.2: Remember Definition and Types of Programming
13
1.2: Remember Definition and Types of Programming
14
1.3 : Types of Programming and Structure Programming
Methodology
15
1.3 : Types of Programming and Structure Programming
Methodology
17
Thank You!!
18