Week 1 – Introduction to Computers and Programming Languages (Part 1)

Slides:



Advertisements
Similar presentations
Etter/Ingber Engineering Problem Solving with C Fundamental Concepts Chapter 1 Engineering Problem Solving.
Advertisements

Senem Kumova Metin Introduction to Programming CS 115 Introduction to Computing PART I : Computer Basics PART II: Introduction to Computing/Programming.
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Lecture 1: Overview of Computers & Programming
 2000 Prentice Hall, Inc. All rights reserved. Chapter 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line.
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.
© 2010 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Chapter 1: Overview of Computers and Programming Problem Solving &
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.
Computing Components 01/26/11. Announcements & Reminders Programs 1 due Friday, 9/2/11 What is my late policy? Proxy Codes for Labs  You should be able.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages C++ 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.
CIS 260 Computer Programming I in C Prof. Timothy Arndt.
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.
Chapter Introduction to Computers and Programming 1.
Introduction to Programming Dr Masitah Ghazali Programming Techniques I SCJ1013.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
Chapter 1 An Overview of Computers and Programming Languages.
Chapter 1: Introduction to Computers and Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
UniMAP Sem1-08/09EKT120: Computer Programming1 Week 1 – Lecture 1.
EKT 120/4 C Programming (Additional note). Computer Fundamentals Computer is a machine that can receive, store, transform an output data of all kinds.
UNIMAP Sem1-08/09EKT120: Computer Programming1 Week 1 – Introduction to Computer and Algorithm.
COMP1050 Winter 2015 Computer System Maintenance.
Introduction to Computer Systems and the Java Programming Language.
1 CISC181 Introduction to Computer Science Dr. McCoy Lecture 1 February 8, 2005.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 2 Chapter 2 - Introduction to C Programming.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages.
COMPUTER PROGRAMMING. Computer programming the objective of the module to gain the necessary skills to develop a computer program using one of the high.
CHAPTER 1 INTRODUCTION 2 nd Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
UniMAP Sem I – 10/11EKT150: Computer Programming 1 Week 1 – Introduction to Computers and Programming Languages (Part 1) Pn. Rusnida bt. Romli & Che Muhammad.
Computing Systems & Programming ECE Fundamental Concepts Chapter 1 Engineering Problem Solving.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
CS2301:Computer Programming 2
Computer Programming (1) Code & No.: CS 102 CREDIT HOURS: 5 UNIT Lecture 3.0 hours/week Lab: 2.0 hour/on every week a. This course introduces the students.
Computer Fundamentals MSCH 233 Lecture 1. What is a computer? A computer is an electronic machine which can accept data in a certain form, process the.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 2 - Introduction to C Programming Outline.
UniMAP Sem2-10/11 DKT121: Fundamental of Computer Programming1 Introduction to C – Part 1.
Week 1 Introduction to Computers and Programming Languages UniMAP Sem II – 12/13 EKT120: Computer Programming 1.
Chapter 1 An Overview of Computers and Programming Languages.
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.
C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 1: An Overview of Computers and Programming Languages.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Chapter 1 Introduction 2nd Semester H
BASIC PROGRAMMING C SCP1103 (02)
EKT150 INTRODUCTION TO COMPUTER PROGRAMMING
Introduction to Programming / chapter 3 / COM1022
Chapter 1: An Overview of Computers and Programming Languages
Engineering Problem Solving With C An Object Based Approach
Chapter 1: An Overview of Computers and Programming Languages
BASIC PROGRAMMING C SCP1103 (02)
Overview of Computers and Programming Chapter 1
Week 1 – Session 1 Pn. Yasmin Yacob 04 – KUKUM Sem2-06/07
DDC 1023 – Programming Technique
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
UNIV 103 CS Majors Seminar Dr. Blaise W. Liffick Fall 2017.
Chapter 1: Introduction to Computers and Programming
Lecture 2: Logical Problems with Choices
Structured Program
1) C program development 2) Selection structure
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
Introduction to Computer Programming
Computer components is a programmable machine that receives input, stores and manipulates data, and provides output in a useful format. Computer The computer.
Introduction to C Programming
ICS103 Programming in C 1: Overview of Computers And Programming
Presentation transcript:

Week 1 – Introduction to Computers and Programming Languages (Part 1) UniMAP Sem II – 09/10 EKT120: Computer Programming

EKT120: Computer Programming General Information Contributes 4 units: 2 hours – lectures 4 hours – labs Main Objective: Students can independently write, compile, debug and execute computer programs to solve problems, especially engineering related problems. UniMAP Sem II – 09/10 EKT120: Computer Programming

EKT120: Computer Programming Course Outcomes Ability to define and describe programming concepts and principles. Ability to apply programming techniques and tools such as flowchart and pseudo code to design computer programs. Ability to apply GNU/Linux for coding, compiling, executing and debugging computer programs. Ability to solve engineering related problems using computer programming techniques. UniMAP Sem II – 09/10 EKT120: Computer Programming

EKT120: Computer Programming Overall Evaluation 4 main components: Theoretical Tests (2) => 50%‏ Lab Assignments (5) / Lab Test => 30% Lab Project => 20%‏ Assignments are assessed individually The two tests are written tests Lab Project : Group of 3 students (max) UniMAP Sem II – 09/10 EKT120: Computer Programming

EKT120: Computer Programming References Deitel & Deitel, Sudin, S., Ahmad, R. Badlishah, and Yacob, Y., “C How to Program”, Pearson-Prentice Hall, 2006. Cheng, H., “C for Engineers and Scientists”, McGraw Hill, 2010. Hanly, J.R. and Koffman, E.B., “C Program Design for Engineers”, 2nd Ed., Addison-Wesley, 2001. ISBN : 0321204174 UniMAP Sem II – 09/10 EKT120: Computer Programming

EKT120: Computer Programming Notes This course is NOT about the language per se, it is about problem solving, analytical skills and to apply C to solve problems. Write C program in Linux environment. Do early reading. Do not hesitate to ask during lecture sessions. How to download lecture notes and lab exercises from portal!!! UniMAP Sem II – 09/10 EKT120: Computer Programming

EKT120: Computer Programming Outline Computer Fundamentals Computer organization and hardware Computer software Programming Languages Machine language Assembly language High-level language Algorithm : pseudo code and flowchart Control Structures Simple C Program UniMAP Sem II – 09/10 EKT120: Computer Programming

Computer Fundamentals Computer system is divided into hardware and software. Hardware refers to physical components of computer which are: Main Memory Central Processing Unit (CPU)‏ Input Device Output Device Secondary Memory Device UniMAP Sem II – 09/10 EKT120: Computer Programming

EKT120: Computer Programming Figure 1.1 The Intel Atom processor chip contains the full circuitry of a central processing unit in an integrated circuit whose small size and low power requirements make it suitable for use in mobile internet devices. (Intel Corporation Pressroom Photo Archives) UniMAP Sem II – 09/10 EKT120: Computer Programming

EKT120: Computer Programming Figure 1.2 (a) Notebook Computer (HP Pavilion dv5©, Courtesy of Hewlett-Packard).   (b) Palmtop Computer (iPhone 3G©, Courtesy of Apple, Inc.) (c) Desktop Computer (iMac©, Courtesy of Apple, Inc.) UniMAP Sem II – 09/10 EKT120: Computer Programming

Figure 1.3 Components of a Computer UniMAP Sem II – 09/10 EKT120: Computer Programming

Computer Hardware CPU Control Unit Input Device Arithmetic and Logic Unit Output Device Register Main Memory Secondary Memory UniMAP Sem II – 09/10 EKT120: Computer Programming

Central Processing Unit (CPU)‏ CPU is the computer’s administrator and is responsible for supervising the operation of the other sections Consists of two functional units; control unit and arithmetic-logic unit (ALU)‏ Control unit supervises all activities of the computer system ALU performs basic arithmetic operations and comparison operations UniMAP Sem II – 09/10 EKT120: Computer Programming

EKT120: Computer Programming Main Memory keeps information from the input unit also keeps processed information until it can be placed on output devices all programs must be loaded into main memory before they can be executed and all data must be brought into main memory before it can be manipulated. UniMAP Sem II – 09/10 EKT120: Computer Programming

EKT120: Computer Programming Main Memory Main memory can be further classified into two types: Random Access Memory (RAM)‏ information in RAM will be lost when the computer is turned-off. Read Only Memory (ROM)‏ It has been set during manufacturing process. ROM usually contains instructions and information considered to be fundamental to the computer. UniMAP Sem II – 09/10 EKT120: Computer Programming

Figure 1.4 1000 Memory Cells in Main Memory UniMAP Sem II – 09/10 EKT120: Computer Programming

EKT120: Computer Programming Secondary Memory Main memory is only used during processing following certain instructions Permanent information is NOT stored in main memory but is stored in secondary memory E.g. program file, data file, etc E.g. hard disk, diskette, CD UniMAP Sem II – 09/10 EKT120: Computer Programming

Figure 1.5 Secondary Storage Media UniMAP Sem II – 09/10 EKT120: Computer Programming

EKT120: Computer Programming Input/Output Devices Input devices - feed data and programs into computers E.g. keyboard, mouse, touch screen, scanners Output devices - display results produced by computer E.g. monitor, printer, speaker UniMAP Sem II – 09/10 EKT120: Computer Programming

EKT120: Computer Programming Software As a complement to hardware, computer system needs software to solve problems. Software are classified into : System software Application software UniMAP Sem II – 09/10 EKT120: Computer Programming

EKT120: Computer Programming Software System software : manages the computer and its peripheral devices (hardware) E.g. Operating system (OS)‏ Text editor Pre-processor Language translator Linker Loader UniMAP Sem II – 09/10 EKT120: Computer Programming

EKT120: Computer Programming Software Application software : performs specific tasks There are two types: Program to solve specific problems Program written by user to solve specified problem E.g. word processor, desktop publishing software, spreadsheets, database, graphics, communication, programs perform specific tasks such as accounting, scientific, engineering, education, etc UniMAP Sem II – 09/10 EKT120: Computer Programming

Programming Languages Programming language is divided into three categories: Machine Language Assembly Language High-Level Language UniMAP Sem II – 09/10 EKT120: Computer Programming

EKT120: Computer Programming Machine Language Language understood by the computer Bunch of 0’s and 1’s Program written in machine language can be executed without being translated Nevertheless, hard to learn because it is written in 0’s and 1’s Program is too long to solve simple problem Machine-dependant and not portable E.g. 0101 0001 1100 0100 1011 1000 0101 1000 0101 1001 1100 0111 UniMAP Sem II – 09/10 EKT120: Computer Programming

Figure 1.6 Relationship Between a Byte and a Bit UniMAP Sem II – 09/10 EKT120: Computer Programming

EKT120: Computer Programming Assembly Language Strings of 0’s and 1’s are replaced into instructions which resemble English language to represent computer operation element Easier to understand and write E.g. LOAD rate MULT hour STOR wages UniMAP Sem II – 09/10 EKT120: Computer Programming

EKT120: Computer Programming Assembly Language Nevertheless, needs language translator called Assembler to change Assembly Language to Machine Code for execution purpose still too long and not portable UniMAP Sem II – 09/10 EKT120: Computer Programming

EKT120: Computer Programming High-Level Language Improves weaknesses in Machine Language and Assembly Language Portable Written in one instruction to carry out several instructions in machine level E.g. discount_price = price – discount; Must be changed to machine code before executed, needs compiler : a system software that translates source program to object program UniMAP Sem II – 09/10 EKT120: Computer Programming

EKT120: Computer Programming Algorithms The solution to any computing problem involves executing series of actions in a specific order Pseudo code : artificial and informal language that helps programmers develop algorithms E.g. if student’s grade is greater than or equal to 50 Print “Pass” else Print “Fail” UniMAP Sem II – 09/10 EKT120: Computer Programming

EKT120: Computer Programming Algorithms Flowchart: visual-form of an algorithm E.g. Begin Data Process 1 Decision Process 2 End UniMAP Sem II – 09/10 EKT120: Computer Programming

Algorithm-Basic symbols in a flowchart Flow direction Start/End Process Connector Input/Output Decision UniMAP Sem II – 09/10 EKT120: Computer Programming

Flowchart-(example)‏ Start read num1, num2 sum=num1+num2 print sum End UniMAP Sem II – 09/10 EKT120: Computer Programming

EKT120: Computer Programming TRY THIS!!! Write a pseudo code, flowchart and program that calculates and prints the SUM of two integers A and B. UniMAP Sem II – 09/10 EKT120: Computer Programming

EKT120: Computer Programming Flowchart Begin Input A,B Calculate A + B Print SUM End Pseudo code Begin Input A and B Calculate A + B Print result of SUM End UniMAP Sem II – 09/10 EKT120: Computer Programming

EKT120: Computer Programming Control Structure All programs could be written in terms of three control structures: Sequence structure Selection structure Repetition structure UniMAP Sem II – 09/10 EKT120: Computer Programming

EKT120: Computer Programming Sequence Structure Is a series of steps executed sequentially by default Pseudo code Flowchart Read num1, num2 Calculate total=num1+num2 Print total Read num1, num2 total = num1+num2 print total UniMAP Sem II – 09/10 EKT120: Computer Programming

EKT120: Computer Programming Selection Structure Used to choose among alternative courses of action C has three types: if, if..else, and switch UniMAP Sem II – 09/10 EKT120: Computer Programming

The if Selection Structure “if” structure is a single-entry/single- exit structure true false grade >= 60 print “Pass” If student’s grade is greater than or equal to 60 Print “Pass”   UniMAP Sem II – 09/10 EKT120: Computer Programming

The if..else Selection Structure Specifies an action to be performed both when the condition is true and when it is false If student’s grade is greater than or equal to 60 Print “Pass” else Print “Fail” true false print “Fail” print “Pass” grade >= 60 UniMAP Sem II – 09/10 EKT120: Computer Programming

EKT120: Computer Programming Repetition Structure Specifies a block of one or more statements that are repeatedly executed until a condition is satisfied Three types : while, for, do-while UniMAP Sem II – 09/10 EKT120: Computer Programming

The while Repetition Structure Programmer specifies an action is to be repeated while some conditions remain true product <= 1000 product = 2 * product true false While product is less than or equal 1000 calculate product=2 * product UniMAP Sem II – 09/10 EKT120: Computer Programming

Basics of a Typical C Program Development Environment UniMAP Sem II – 09/10 EKT120: Computer Programming

EKT120: Computer Programming Figure 1.7 Entering, Translating, and Running a High-Level Language Program UniMAP Sem II – 09/10 EKT120: Computer Programming

Figure 1.8 Flow of Information During Program Execution UniMAP Sem II – 09/10 EKT120: Computer Programming

Simple C Program: Program to add two numbers #include <stdio.h> int main(void)‏ { int A, B, SUM; printf (“input first integer \n”); scanf (“%d”, &A)‏ printf (“input second integer \n”); scanf (“%d”, &B)‏ SUM = A + B; printf (“Sum is %d\n”, SUM); return 0; } OUTPUT Input first integer 39 Input second integer 27 Sum is 66 Things to do: 1. Download lecture notes from portal 2. Download lab exercises for Week 1 from portal UniMAP Sem II – 09/10 EKT120: Computer Programming

EKT120: Computer Programming End Week 1 – Session 1 Q & A! UniMAP Sem II – 09/10 EKT120: Computer Programming