Download presentation
1
CIS 103 - Computer Programming Logic
Programming Concepts Overview prepared by Jack Wilson Cerritos College Property of Jack Wilson, Cerritos College
2
Topics 1.1 Programs 1.2 Modules 1.3 Algorithms 1.4 Statements 1.5 Syntax & Semantics 1.6 Logic Planning Tools 1.7 Control Structures 1.8 Memory Concepts 1.9 Data Types Programming Concepts Overview Property of Jack Wilson, Cerritos College
3
1.1 Programs A program contains one or more modules.
Many languages require a module with a special name, such as "main" for a program to be created. Programs are often also referred to as applications or more generally as software. Program module module Programming Concepts Overview Property of Jack Wilson, Cerritos College
4
1.2 Modules A module is a collection of statements that perform a specific task within a program. Module is a generic term. The most commonly used terms are listed below. function C, C++, Python method Java Programming Concepts Overview Property of Jack Wilson, Cerritos College
5
1.3 Algorithms An algorithm is the name given to the logic that is developed and used to code the statements in a module. Algorithm to square a number: get a number multiply the number by itself return this value Implementation of the algorithm in a module (function): double square ( double number ) { return number * number; } Programming Concepts Overview Property of Jack Wilson, Cerritos College
6
1.4 Statements A statement is the name given to a high level language instruction. Programs are written using a variety of different types of statements. Examples include: Declaration int count Assignment count = 0 Input get(number) Output put(“Grand Total is “ + total) Module Invocation printHeadings() Programming Concepts Overview Property of Jack Wilson, Cerritos College
7
1.5 Syntax & Semantics Syntax refers to the rules of a language that must be followed to construct a valid statement. Statements are constructed using the following components: reserved words ( aka keywords ) identifiers operators literals punctuation symbols Semantics refers to the meaning of a statement. It addresses the question "What does the statement do?“. Programming Concepts Overview Property of Jack Wilson, Cerritos College
8
1.6 Control Structures A control Structure determines the flow of execution for statements executing in a module. There are 3 control structures that are used in all programming languages: Sequence Selection Repetition (aka Iteration) Programming Concepts Overview Property of Jack Wilson, Cerritos College
9
1.6 Control Structures Sequence Structure
A sequence structure performs a single task without asking any questions or repeating anything. declare a variable assign a value to a variable input a value output a value call a function return a value from a function stop program execution Programming Concepts Overview Property of Jack Wilson, Cerritos College
10
The rectangle represents a structure.
1.6 Control Structures false true Selection Structure Asks a question (called a condition) and based on the answer ( true or false ) follows a path of execution. In example 2, only one of the paths of execution would be followed. The diamond symbol represents a condition that evaluates to true or false. The rectangle represents a structure. Example 1 – One path of execution false true Example 2 – Two paths of execution Programming Concepts Overview Property of Jack Wilson, Cerritos College
11
1.6 Control Structures Repetition Structure
Asks a question (called the condition) and based on the answer ( true or false ) executes a statement or exits the structure. Continues to execute the statement as long as the condition evaluates to yes. A repetition structure is often called a "loop". true false Example 1: Pre-test loop The rectangle represents a statement. The diamond represents a condition. true false Example 2: Post-test loop Programming Concepts Overview Property of Jack Wilson, Cerritos College
12
1.7 Logic Planning Tools Pseudocode Flowchart Hierarchy Chart
Printer/Screen Spacing Chart File Description (record layout chart) Programming Concepts Overview Property of Jack Wilson, Cerritos College
13
1.8 Memory Concepts Memory is measured in bytes ( KB / MB / GB / TB )
A byte is 8 bits ( binary digits ) Every byte in RAM memory is assigned a unique address Data types use one or more bytes to store information integer – 4 bytes real number – 8 bytes Programming Concepts Overview Property of Jack Wilson, Cerritos College
14
1.8 Memory Concepts To avoid having to reference a specific location in memory to access a piece of data, variable names are used instead of addresses. To use a variable in a program, you must declare the variable by giving it a name and a data type. [ RAPTOR does not require us to do this ] Examples: int count boolean finished string name When a program is executed, a symbol table ( think of it as a data dictionary in memory ) is created that maps the name of a variable to the location in memory where the data is being stored. Programming Concepts Overview Property of Jack Wilson, Cerritos College
15
1.9 Data Types Programs work with data ( information stored in locations in memory ). There are many different categories of data. Every language has specific keywords which are used to specify a data type. Not all data types are supported in all languages. Here are some examples: Numeric integer numbers real numbers Text a single character value a "string" of characters Boolean True False Language Numeric Text Boolean Java int long float double char String boolean C++ string bool Programming Concepts Overview Property of Jack Wilson, Cerritos College
16
x.Xx Program Translation
Translators Assembler Compiler Interpreter JIT compilation Programming Concepts Overview Property of Jack Wilson, Cerritos College
17
Identifiers Programming Concepts Overview Property of Jack Wilson, Cerritos College
18
Expressions and Statements
Programming Concepts Overview Property of Jack Wilson, Cerritos College
19
Object-Oriented Programming
Programming Concepts Overview Property of Jack Wilson, Cerritos College
20
Procedural Programming
Programming Concepts Overview Property of Jack Wilson, Cerritos College
21
Event-Driven Programming
Programming Concepts Overview Property of Jack Wilson, Cerritos College
22
Reserved Words Programming Concepts Overview Property of Jack Wilson, Cerritos College
23
Operators Mathematical (arithmetic) Relational (boolean) Logical
Programming Concepts Overview Property of Jack Wilson, Cerritos College
24
Operator Precedence and Associativity
Programming Concepts Overview Property of Jack Wilson, Cerritos College
25
File Input Programming Concepts Overview Property of Jack Wilson, Cerritos College
26
File Output Programming Concepts Overview Property of Jack Wilson, Cerritos College
27
Program Development Programming Concepts Overview Property of Jack Wilson, Cerritos College
28
Making Decisions Programming Concepts Overview Property of Jack Wilson, Cerritos College
29
Looping Programming Concepts Overview Property of Jack Wilson, Cerritos College
30
Working with Strings Programming Concepts Overview Property of Jack Wilson, Cerritos College
31
Arrays Programming Concepts Overview Property of Jack Wilson, Cerritos College
32
Classes Programming Concepts Overview Property of Jack Wilson, Cerritos College
33
Class Diagrams Programming Concepts Overview Property of Jack Wilson, Cerritos College
34
Formatted Output Programming Concepts Overview Property of Jack Wilson, Cerritos College
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.