Property of Jack Wilson, Cerritos College1 CIS 103 - Computer Programming Logic Programming Concepts Overview prepared by Jack Wilson Cerritos College.

Slides:



Advertisements
Similar presentations
Chapter 4 Computation Bjarne Stroustrup
Advertisements

Objectives Understand the software development lifecycle Perform calculations Use decision structures Perform data validation Use logical operators Use.
CS 111: Introduction to Programming Midterm Exam NAME _________________ UIN __________________ 10/30/08 1.Who is our hero? 2.Why is this person our hero?
Conditional statements and Boolean expressions. The if-statement in Java (1) The if-statement is a conditional statement The statement is executed only.
Primitive Data Types There are a number of common objects we encounter and are treated specially by almost any programming language These are called basic.
COSC 120 Computer Programming
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Program Design and Development
1 Key Concepts:  Why C?  Life Cycle Of a C program,  What is a computer program?  A program statement?  Basic parts of a C program,  Printf() function?
Programming Logic and Design, Introductory, Fourth Edition1 Understanding Computer Components and Operations (continued) A program must be free of syntax.
Moving To Code 3 More on the Problem-Solving Process §The final step in the problem-solving process is to evaluate and modify (if necessary) the program.
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 1 Introduction.
String Escape Sequences
Basic Elements of C++ Chapter 2.
Program A computer program (also software, or just a program) is a sequence of instructions written in a sequence to perform a specified task with a computer.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
Why Program? Computer – programmable machine designed to follow instructions Program – instructions in computer memory to make it do something Programmer.
Chapter Introduction to Computers and Programming 1.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
 2003 Prentice Hall, Inc. All rights reserved. 1 Introduction to C++ Programming Outline Introduction to C++ Programming A Simple Program: Printing a.
CSCI 1100/1202 January 16, Why do we need variables? To store intermediate results in a long computation. To store a value that is used more than.
High-Level Programming Languages: C++
CIS Computer Programming Logic
1. Reference  2  Algorithm :- Outline the essence of a computational procedure, step by step instructions.  Program :- an.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming 1.
Created by, Author Name, School Name—State FLUENCY WITH INFORMATION TECNOLOGY Skills, Concepts, and Capabilities.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Chapter 1: Introduction to Computers and Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Seventh Edition by Tony Gaddis, Judy.
DEPARTMENT OF COMPUTER SCIENCE & TECHNOLOGY FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UWA WELLASSA 1 CST 221 OBJECT ORIENTED PROGRAMMING(OOP) ( 2 CREDITS.
1 © 2000 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.
Program A computer program (also software, or just a program) is a sequence of instructions written in a sequence to perform a specified task with a computer.
Input, Output, and Processing
Introduction to Computer Systems and the Java Programming Language.
S2008Final_part1.ppt CS11 Introduction to Programming Final Exam Part 1 S A computer is a mechanical or electrical device which stores, retrieves,
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
Lec 6 Data types. Variable: Its data object that is defined and named by the programmer explicitly in a program. Data Types: It’s a class of Dos together.
CIS-165 C++ Programming I CIS-165 C++ Programming I Bergen Community College Prof. Faisal Aljamal.
Visual Basic Programming
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
Introduction to Programming
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 2A Reading, Processing and Displaying Data (Concepts)
CHAPTER 2 PROBLEM SOLVING USING C++ 1 C++ Programming PEG200/Saidatul Rahah.
Higher Computing Science 2016 Prelim Revision. Topics to revise Computational Constructs parameter passing (value and reference, formal and actual) sub-programs/routines,
Variables  A piece of memory set aside to store data  When declared, the memory is given a name  by using the name, we can access the data that sits.
 Data Type is a basic classification which identifies different types of data.  Data Types helps in: › Determining the possible values of a variable.
Chapter 4: Variables, Constants, and Arithmetic Operators Introduction to Programming with C++ Fourth Edition.
Copyright © 2014, 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Eighth Edition by Tony Gaddis,
Chapter 1: Introduction to Computers and Programming.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Chapter 1: Introduction to Computers and Programming
C++ First Steps.
Chapter Topics The Basics of a C++ Program Data Types
Topics Designing a Program Input, Processing, and Output
Basic Elements of C++.
Revision Lecture
Variables A piece of memory set aside to store data
Basic Elements of C++ Chapter 2.
Chapter 1: Introduction to Computers and Programming
Building Java Programs Chapter 2
Programming Funamental slides
Topics Introduction to Value-returning Functions: Generating Random Numbers Writing Your Own Value-Returning Functions The math Module Storing Functions.
Topics Designing a Program Input, Processing, and Output
Understand the interaction between computer hardware and software
Topics Designing a Program Input, Processing, and Output
Chapter 1: Introduction to Computers and Programming
Presentation transcript:

Property of Jack Wilson, Cerritos College1 CIS Computer Programming Logic Programming Concepts Overview prepared by Jack Wilson Cerritos College

Programming Concepts Overview Property of Jack Wilson, Cerritos College 2 Topics 1.1Programs 1.2Modules 1.3Algorithms 1.4Statements 1.5Syntax & Semantics 1.6Logic Planning Tools 1.7Control Structures 1.8Memory Concepts 1.9Data Types

Programming Concepts Overview Property of Jack Wilson, Cerritos College Programs A program contains one or more modules. Some 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

Programming Concepts Overview Property of Jack Wilson, Cerritos College Modules A module is a collection of statements that performs a specific task within a program. Module is a generic term. Programming languages uses different names for modules. Examples include: function [ C, C++, VisualBasic ] method [ Java ] subprocedure [ VisualBasic ]

Programming Concepts Overview Property of Jack Wilson, Cerritos College Algorithms An algorithm is the name given to the logic that is developed and used to code the statements in a module. Implementation of the algorithm in a module (function): double square ( double number ) { return number * number; } Algorithm to square a number: 1.get a number 2.multiply the number by itself 3.return this value

Programming Concepts Overview Property of Jack Wilson, Cerritos College 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:  Input  Output  Declaration  Assignment  Processing  Compiler / Pre-Processor Directives

Programming Concepts Overview Property of Jack Wilson, Cerritos College 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 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: 1. Sequence 2. Selection 3. Repetition

Programming Concepts Overview Property of Jack Wilson, Cerritos College Control Structures Sequence Structure A single statement or multiple statements executed sequentially, one after another. Example 1 Example 2

Programming Concepts Overview Property of Jack Wilson, Cerritos College Control Structures Selection Structure Asks a question and based on the answer ( true or false ) one of possibly 2 paths of execution is taken. Example 1 – One path of execution Example 2 – Two paths of execution truefalse true

Programming Concepts Overview Property of Jack Wilson, Cerritos College Control Structures Repetition Structure Asks a question and based on the answer ( true or false ) executes a statement. Continues to execute the statement as long as the question evaluates to yes. A repetition structure is usually called a "loop". Example 1: Pre-test loop Example 2: Post-test loop true false true

Programming Concepts Overview Property of Jack Wilson, Cerritos College Logic Planning Tools Pseudocode Flowchart IPO ( Input - Process – Output ) Chart Structure Chart Decision Tree/Table Printer Spacing Chart Screen Layout Chart Record Layout Form [ text file ] Table Definition [ database file ]

Programming Concepts Overview Property of Jack Wilson, Cerritos College Memory Concepts Memory is measured in bytes ( MB / GB / TB ) A byte is 8 bits ( binary digits ) Every byte is assigned a unique address in memory Data types use one or more bytes to store information There are different formats for storing different types of data. Characters are stored quite differently than are real numbers or dates.

Programming Concepts Overview Property of Jack Wilson, Cerritos College 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. Examples: int count; boolean finished; Dim name As String 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 Data Types Numeric  integer numbers  real numbers Text  a single character value  a "string" of characters Boolean  True  False Currency Date/Time Object Programs work with data ( information stored in locations in memory ). There are many different categories of data. Every language has a specific keywords which are used to specify a data type. Not all data types are supported in all languages. Here are some examples: LanguageNumericTextBooleanCurrency Javaint long float double char String booleannot supported C++int long float double char char[ ] string boolnot supported VisualBasicInteger Long Single Double Char String BooleanDecimal