Week 1 – Session 1 Pn. Yasmin Yacob 04 – KUKUM Sem2-06/07

Slides:



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

EC-111 Algorithms & Computing Lecture #1 Instructor: Jahan Zeb Department of Computer Engineering (DCE) College of E&ME NUST.
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Lecture 1: Overview of Computers & Programming
EKT 120/4 : Computer Programming
1 Engineering Problem Solving With C++ An Object Based Approach Fundamental Concepts Chapter 1 Engineering Problem Solving.
Wednesday, 9/4/02, Slide #1 1 CS 106 Intro to CS 1 Wednesday, 9/4/02  Today: Introduction, course information, and basic ideas of computers and programming.
Introduction to Computer Systems
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.
CS102 Introduction to Computer 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.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
Chapter 1 An Overview of Computers and Programming Languages.
INTRODUCTION TO COMPUTER PROGRAMMING itc-314 LECTURE 01.
INTRODUCTION TO COMPUTING
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.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Computer Organization Six logical units in every.
UNIMAP Sem1-08/09EKT120: Computer Programming1 Week 1 – Introduction to Computer and Algorithm.
1 CISC181 Introduction to Computer Science Dr. McCoy Lecture 1 February 8, 2005.
Lecture 2: Logical Problems with Choices. Problem Solving Before writing a program Have a thorough understanding of the problem Carefully plan an approach.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages.
EKT120: Computer Programming
EG280 Computer Science for Engineers Fundamental Concepts Chapter 1.
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 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.
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 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.
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.
 2003 Prentice Hall, Inc. All rights reserved. 1 Basic C++ Programming.
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.
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.
Victoria Ibarra Mat:  Generally, Computer hardware is divided into four main functional areas. These are:  Input devices Input devices  Output.
CHAPTER 1 OVERVIEW OF COMPUTER AND PROGRAMMING 1.1 Electronic Computer Then and Now 1.2 Computer Hardware 1.3 Computer Software 1.4 The Software Development.
Chapter 1: Introduction to Computers and Programming
Chapter 1 Introduction 2nd Semester H
BASIC PROGRAMMING C SCP1103 (02)
Week 1 – Introduction to Computers and Programming Languages (Part 1)
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)
Chapter 1: An Overview of Computers and Programming Languages
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Chapter 1: An Overview of Computers and Programming Languages
Programming Fundamentals
C++ Programming: From Problem Analysis to Program Design
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.
National Diploma in Computer Studies
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
Structural Program Development: If, If-Else
Chapter 1: Introduction to Computers and Programming
Presentation transcript:

Pn. Yasmin Yacob 04 – 979 8418 Yasmin.yacob@kukum.edu.my Week 1 – Session 1 Pn. Yasmin Yacob 04 – 979 8418 Yasmin.yacob@kukum.edu.my KUKUM Sem2-06/07 DKT121: Fundamental of Computer Programming

DKT121: Fundamental of Computer Programming General Information Contributes 3 units: 2 hours - lectures 2 hours – lab and tutorial Main Objective: Students can independently write a computer program to solve calculation problems, especially those related to engineering KUKUM Sem2-06/07 DKT121: Fundamental of Computer Programming

DKT121: Fundamental of Computer Programming Overall Evaluation 4 main components: Assignments (20%) 1st & 2nd Test (10%) Group Mini-project (30%) Assignments are individual “take home” + lab The two tests are written tests Project : Max number of group member is 2 KUKUM Sem2-06/07 DKT121: Fundamental of Computer Programming

DKT121: Fundamental of Computer Programming References “C How To Program”, Deitel and Deitel,Suhizaz Sudin, R. Badlishah andYasmin Yacob, Pearson-Prentice Hall ,2004 “C Programming for Engineering & Computer Science ”, H.H.Tan and T.B.Orazio, Mc Graw Hill, 1999. Any other C programming books KUKUM Sem2-06/07 DKT121: Fundamental of Computer Programming

DKT121: Fundamental of Computer Programming Notes This course is NOT about the language per se, it’s about problem solving / analytical skills & to apply C to solve problems. Write C program in Linux environment Do early reading Do not hesitate to ask during lecture sessions KUKUM Sem2-06/07 DKT121: Fundamental of Computer Programming

DKT121: Fundamental of Computer Programming Outline Computer fundamentals Computer organization and hardware Computer software Programming languages Machine language Assembly language High-level language Algorithm : pseudocode and flowchart Control structures Simple C program KUKUM Sem2-06/07 DKT121: Fundamental of Computer Programming

Computer Fundamentals Computer system are divided into hardware and software. Hardware refers to physical components of computers which are: Main memory Central Processing Unit(CPU) Input Device Output Device Secondary memory device KUKUM Sem2-06/07 DKT121: Fundamental of Computer Programming

Computer Hardware CPU Control Unit Input Device Arithmetic and Logic Unit Output Device Register Main Memory Secondary Memory KUKUM Sem2-06/07 DKT121: Fundamental of Computer Programming

Central Processing Unit(CPU) CPU is the computer’s administrator and is responsible for supervising the operation of the other section Consists of two functional units: a control unit and an arithmetic-logic unit(ALU) Control unit supervises all activities of the computer system ALU perform basic arithmetic operations and comparison operations KUKUM Sem2-06/07 DKT121: Fundamental of Computer Programming

DKT121: Fundamental of 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. KUKUM Sem2-06/07 DKT121: Fundamental of Computer Programming

DKT121: Fundamental of 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) they have been set during the manufacturing process. ROM usually contains instructions and information considered to be fundamental to the computer. KUKUM Sem2-06/07 DKT121: Fundamental of Computer Programming

DKT121: Fundamental of 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 fail etc E.g hard disk, diskette, CD KUKUM Sem2-06/07 DKT121: Fundamental of Computer Programming

DKT121: Fundamental of Computer Programming Input/Output Device Input device - feeds data and programs into computers E.g. keyboard, mouse, touch screen, scanners Output device - display results produced by computer E.g. monitor, printer, speaker KUKUM Sem2-06/07 DKT121: Fundamental of Computer Programming

DKT121: Fundamental of Computer Programming Software As a complement to hardware, computer system needs software to solve problems. Software are classified into : System software Application software KUKUM Sem2-06/07 DKT121: Fundamental of Computer Programming

DKT121: Fundamental of Computer Programming Software System software : manage the computer and its peripheral devices (hardware) E.g. Operating systems(OS) Text editor Preprocessor Language translator Linker Loader KUKUM Sem2-06/07 DKT121: Fundamental of Computer Programming

DKT121: Fundamental of 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, program perform a specific task such as accounting, scientific, engineering, education etc KUKUM Sem2-06/07 DKT121: Fundamental of Computer Programming

Programming Languages Programming language is divided into three categories: Machine Language Assembly Language High-Level Language KUKUM Sem2-06/07 DKT121: Fundamental of Computer Programming

DKT121: Fundamental of 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 1000 0101 1001 1100 0111 0101 0001 1100 0100 1011 1000 KUKUM Sem2-06/07 DKT121: Fundamental of Computer Programming

DKT121: Fundamental of Computer Programming Assembly Language Strings of 0’s and 1’s are replaced into instructions which resembles English language to represent computer operation element Easier to understand and written E.g LOAD rate MULT hour STOR wages KUKUM Sem2-06/07 DKT121: Fundamental of Computer Programming

DKT121: Fundamental of Computer Programming Assembly Language Nevertheless, need language translator called Assembler to change Assembly Language to Machine Code for execution purpose still too long and not portable KUKUM Sem2-06/07 DKT121: Fundamental of Computer Programming

DKT121: Fundamental of Computer Programming High-Level Language Improve weaknesses in Machine Language and Assembly Language portable Written in one instruction to carry out several instruction in machine level E.g. discount_price = price – discount; Must be changed to machine code before executed, need compiler : a system software that translate source program to object program KUKUM Sem2-06/07 DKT121: Fundamental of Computer Programming

DKT121: Fundamental of Computer Programming Algorithms The solution to any computing problem involves executing a series of actions in a specific order Pseudocode : 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” KUKUM Sem2-06/07 DKT121: Fundamental of Computer Programming

DKT121: Fundamental of Computer Programming Algorithms Flowchart: visual-form of an algorithm E.g. Begin Data Process 1 Decision Process 2 End KUKUM Sem2-06/07 DKT121: Fundamental of Computer Programming

Algorithm-Basic symbols in a flowchart Flow direction Start/ End Process Connector Input/Output Decision KUKUM Sem2-06/07 DKT121: Fundamental of Computer Programming

DKT121: Fundamental of Computer Programming Flowchart-(E.g) Start read num1, num2 sum=num1+num2 print sum End KUKUM Sem2-06/07 DKT121: Fundamental of Computer Programming

DKT121: Fundamental of Computer Programming Control Structure All programs could be written in terms of three control structures: Sequence structure Selection structure Repetition structure KUKUM Sem2-06/07 DKT121: Fundamental of Computer Programming

DKT121: Fundamental of Computer Programming Sequence structure Is a series of steps executed sequentially by default Pseudocode Flowchart Read num1,num2 Calculate total=num1+num2 Print total Read num1,num2 total = num1+num2 print total KUKUM Sem2-06/07 DKT121: Fundamental of Computer Programming

DKT121: Fundamental of Computer Programming Selection structure Used to choose among alternative courses of action C has three types: if, if..else, and switch KUKUM Sem2-06/07 DKT121: Fundamental of Computer Programming

The if selection structure if structure is a single-entry/single-exit structure If student’s grade is greater than or equal to 60 Print “Passed” true false grade >= 60 print “Passed”   KUKUM Sem2-06/07 DKT121: Fundamental of 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 “Passed” else Print “Failed” true false print “Failed” print “Passed” grade >= 60 KUKUM Sem2-06/07 DKT121: Fundamental of Computer Programming

DKT121: Fundamental of 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 KUKUM Sem2-06/07 DKT121: Fundamental of Computer Programming

The while repetition structure Programmer specifies an action is to be repeated while some conditions remains true product <= 1000 product = 2 * product true false While product is less than or equal 1000 calculate product=2 * product KUKUM Sem2-06/07 DKT121: Fundamental of Computer Programming

DKT121: Fundamental of Computer Programming Simple C Program //This program will calculate number of RM 50, RM 20, RM 10, RM 5 and RM 1 notes //for a given value entered by user. #include <stdio.h> int main(void) { int value, balance; int note50, note20, note10, note5, note1; printf("Enter value in RM : "); scanf("%d",&value); note50 = value / 50; balance = value % 50; note20 = balance /20; balance = balance % 20; note10 = balance / 10; balance = balance % 10; note5 = balance / 5; note1 = balance % 5; printf("Number of RM 50 notes : %d\n", note50); printf("Number of RM 20 notes : %d\n", note20); printf("Number of RM 10 notes : %d\n", note10); printf("Number of RM 5 notes : %d\n", note5); printf("Number of RM 1 notes : %d\n", note1); return 0; } KUKUM Sem2-06/07 DKT121: Fundamental of Computer Programming

DKT121: Fundamental of Computer Programming End Week 1 – Session 1 Q & A! KUKUM Sem2-06/07 DKT121: Fundamental of Computer Programming