Computer Programming Basics Assistant Professor Jeon, Seokhee Assistant Professor Department of Computer Engineering, Kyung Hee University, Korea.

Slides:



Advertisements
Similar presentations
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Advertisements

Lecture 1: Overview of Computers & Programming
Overview of Computers & Programming Languages Chapter 1.
COSC 120 Computer Programming
Engineering Problem Solving With C++ An Object Based Approach Fundamental Concepts Chapter 1 Engineering Problem Solving.
Chapter 1: An Overview of Computers and Programming Languages J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design First Edition by Tony Gaddis.
1 Engineering Problem Solving With C++ An Object Based Approach Fundamental Concepts Chapter 1 Engineering Problem Solving.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
1 Lecture 1  Getting ready to program  Hardware Model  Software Model  Programming Languages  The C Language  Software Engineering  Programming.
Chapter 1: An Overview of Computers and Programming Languages
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages C++ Programming:
Topic 1: Introduction to Computers and Programming
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.
Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 1 Introduction To Computers.
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
Chapter Introduction to Computers and Programming 1.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design.
Chapter 1 An Overview of Computers and Programming Languages.
Introduction to Programming Lecture Number:. What is Programming Programming is to instruct the computer on what it has to do in a language that the computer.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
Topics Introduction Hardware and Software How Computers Store Data
Chapter 1: Introduction to Computers and Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Lesson 1b: Computer Systems and Program Development CPS118.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Seventh Edition by Tony Gaddis, Judy.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 1 Introduction to Computers and Programming.
Programming With C.
Chapter 1: An Overview of Computers and Programming Languages
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages.
Chapter 1 Introduction Chapter 1 Introduction 1 st Semester 2015 CSC 1101 Computer Programming-1.
Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm.
CHAPTER 1 INTRODUCTION 1 st Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
CHAPTER 1 INTRODUCTION 2 nd Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
Chapter 1 : Overview of Computer and Programming By Suraya Alias
A.Abhari CPS1251 Topic 1: Introduction to Computers Computer Hardware Computer components Connecting Computers Computer Software Operating System (OS)
Computer and Programming. Computer Basics: Outline Hardware and Memory Programs Programming Languages and Compilers.
Chapter 1 An Overview of Computers and Programming Languages.
Lecture #1: Introduction to Algorithms and Problem Solving Dr. Hmood Al-Dossari King Saud University Department of Computer Science 6 February 2012.
Evolution of C and C++ n C was developed by Dennis Ritchie at Bell Labs (early 1970s) as a systems programming language n C later evolved into a general-purpose.
PROGRAMMING FUNDAMENTALS INTRODUCTION TO PROGRAMMING. Computer Programming Concepts. Flowchart. Structured Programming Design. Implementation Documentation.
INTRODUCTION TO COMPUTER PROGRAMMING(IT-303) Basics.
Copyright © 2014, 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Eighth Edition by Tony Gaddis,
C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 1: An Overview of Computers and Programming Languages.
Software Engineering Algorithms, Compilers, & Lifecycle.
Victoria Ibarra Mat:  Generally, Computer hardware is divided into four main functional areas. These are:  Input devices Input devices  Output.
Chapter 1: Introduction to Computers and Programming
Computer Basics.
Chapter 1 Introduction 2nd Semester H
BASIC PROGRAMMING C SCP1103 (02)
Chapter 1: An Overview of Computers and Programming Languages
Engineering Problem Solving With C An Object Based Approach
Topics Introduction Hardware and Software How Computers Store Data
CSCI-235 Micro-Computer Applications
Chapter 1: An Overview of Computers and Programming Languages
BASIC PROGRAMMING C SCP1103 (02)
Microprocessor Systems Design I
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Chapter 1: An Overview of Computers and Programming Languages
C++ Programming: From Problem Analysis to Program Design
Overview of Computers & Programming Languages
Chapter 1: Introduction to Computers and Programming
Computers: Hardware and Software
Topics Introduction Hardware and Software How Computers Store Data
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
Chapter 1 Introduction(1.1)
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
ICS103 Programming in C 1: Overview of Computers And Programming
Chapter 1: Introduction to Computers and Programming
Presentation transcript:

Computer Programming Basics Assistant Professor Jeon, Seokhee Assistant Professor Department of Computer Engineering, Kyung Hee University, Korea

LECTURE 2

Review “A computer is a general purpose device that can be programmed to carry out a finite set of arithmetic or logical operations.” Device? Hardware! Programmed? Software! Arithmetic or logical? Digital!

A BIT MORE ABOUT COMPUTER - HOW A COMPUTER WORKS FROM “BIT” TO “PROGRAM”

Typical Personal Computer Hardware Input devices Output devices System Unit CPU Main memory Disks

Digital and Analogue

Why Digital? Digital is simple!  Every signal can be expressed by a limited number of digits (numbers). (analogue is not) Digital is efficient!  Digits can be easily stored, transmitted, and copied.

Binary For computers, binary is the most efficient way to express numbers because –Binary  0 and 1  0 volt and 5 volt Converting decimal to binary

How Binary Is Actually Stored Hard disk

How Binary is Actually Stored ROM (Read only memory) RAM (Random access memory)

Bit and Byte Number of BitsNameNumber of BytesRange 8Byte10 to 255 (unsigned) 16 or 32 depending on machine Word2 or 4 0 to 65,535 (unsigned) or 0 to 2 32 − 1 (unsigned)

Management of Memory Byte Memory address

Bit can Represent Everything Character –Encoding: character-bit pattern pairs –E.g., ‘a’  , ‘D’  Color of a pixel –Combination of Red-Green-Blue. Each component has 8- bit-depth intensity – e.g., white  R: G: B: Yellow  R: G: B: Sound –Sampling and discretizing sound wave form

Binary Operations in CPU Binary Operations in CPU Adding A and B Multiplying A0A1 and B0B1 InputsOutputs ABC in C out S

All Connected Digital data Store in hard disk Loaded in memory Operated in CPU

What Programs Do Digital data Store in hard disk Loaded in memory Operated in CPU

Review Digital  limited amount of numbers Numbers  treated as binary in computers Binary  bit and byte Byte  a basic unit in memory CPU  does binary operations The flow of bit  hard disk -> memory -> CPU Program  managing the flow of bit

Review of Programming Language Hierarchy

Hierarchy of Programming Language The movie “Matrix” Can’t you see? Neo is here.

Hierarchy of Programming Language The movie “Matrix” Now you can pick Neo, but not clearly.

Hierarchy of Programming Language The movie “Matrix”

Why We Need High-Level Language Machine language: A binary-based language that a machine can understand –Not human friendly –Hardware dependent

Why We Need High-Level Language Assembly language: a one–to–one correspondence from a binary machine instruction to a more human-friendly mnemonics. –Still quite hard for human programmers to develop big, structured program. –Still hardware dependent

Why We Need High-Level Language High level language –Getting away from hardware  one code can be used for many different computers –Strong abstraction from the details of the computer  higher programming efficiency –Natural language element  easier to understand

SOLVING PROBLEMS USING COMPUTER

System Development

Program Development Process 1.Understand the problem 2.Develop a solution 3.Write a program 4.Test the program

1. Understand the Problem Calculate the square meters of your house. What is the definition of square meter? How is the square meter going to be used? -for insurance purposes? -to paint ? … Is the garage included? -…

2. Develop a Solution Structure chart –Hierarchy chart –Each step will be a separate module.

2. Develop a Solution Algorithm Calculate Bathrooms 1 prompt user and read linoleum price 2 prompt user and read number of bathrooms 3 set total bath areas and baths processed to zero 4 while ( baths processed < number of bathrooms) 1 prompt user and read bath length and width 2 total bath area = 3 total bath area + bath length * bath width 4 add 1 to baths processed 5 end while 6 bath cost = total bath area * linoleum price 7 return bath cost 8 end Algorithm Calculate Bathrooms Pseudocode A precise algorithmic description of program logic Flowchart Graphical version of pseudocode

3. Write a Program Writing and editing programs –Text editor –Source file Compiling programs –Compiler: preprocessor/translator Linking programs –The linker assembles all of functions (source and system’s) into final executable program. 31/37

3. Writing a Program (Executing) Getting the program into memory is the function of an operating system (OS) program known as the loader.

4. Test the Program Specification errors –When the problem definition is either incorrectly stated or misinterpreted. –They should be caught during blackbox testing. Code errors –Compiler error message Logic errors –They can be corrected only by thorough whitebox testing.