BASIC PROGRAMMING C SCP1103 (02)

Slides:



Advertisements
Similar presentations
Lecture 1: Overview of Computers & Programming
Advertisements

 Computer hardware components are the physical pieces of the computer.  The major hardware components of a computer are: – The central processing.
COSC 120 Computer Programming
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Sixth Edition by Tony Gaddis, Judy Walters,
Computer Hardware.
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.
CS 0008 Day 2 1. Today Hardware and Software How computers store data How a program works Operators, types, input Print function Running the debugger.
Copyright 2003 Scott/Jones Publishing Brief Version of Starting Out with C++, 4th Edition 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.
CS102 Introduction to Computer Programming
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.
Introduction to Programming Dr Masitah Ghazali Programming Techniques I SCJ1013.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
Introduction to Programming. Our Book in CS Why Program? Lets watch a video
Chapter 3 Computer Hard ware
Topics Introduction Hardware and Software How Computers Store Data
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming 1.
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.
An Introduction to Computers August 12, 2008 Mrs. C. Furman.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 1 Introduction to Computers and Programming.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages.
What is a computer? Computer is a device for processing information.
Computer Systems Mrs. Butera. Computer Systems Hardware Software.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
A.Abhari CPS1251 Topic 1: Introduction to Computers Computer Hardware Computer components Connecting Computers Computer Software Operating System (OS)
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.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Seventh Edition by Tony Gaddis, Judy.
Introduction عزيزتي الطالبة : يهدف هذا المبحث من تمكينك من التعرف الى مفهوم لغات البرمجة وتعلم أسياسيات لغة البرمجة من خلال دراسة أجزاء من لغة C++ وكتابة.
Brief Version of Starting Out with C++ Chapter 1 Introduction to Computers and Programming.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming Dr. Halla Abdel Hameed.
©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved. Introduction to Computers and Computing.
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.
Chapter 1: Introduction to Computers and Programming.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Introduction To Computer Programming – 1A Computer Parts, Words, and Definition Herriman High School.
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.
Introduction to Programming. Key terms  CPU  I/O Devices  Main memory  Secondary memory  Operating system  User interface  Application  GUI 
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 1: Introduction to Computers and Programming.
Chapter 1: Introduction to Computers and Programming
History of C and basics of Programming
Computer Architecture and Number Systems
BASIC PROGRAMMING C SCP1103 (02)
Functions and Parts of a Computer
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
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
C++ Programming: From Problem Analysis to Program Design
Introduction to Computers
The Computer Work Stations
Chapter 1: Introduction to Computers and Programming
Computer Electronic device Accepts data - input
Introduction to Computers
Topics Introduction Hardware and Software How Computers Store Data
Chapter 1 Introduction(1.1)
Computer Electronic device Accepts data - input
ICS103 Programming in C 1: Overview of Computers And Programming
Chapter 1: Introduction to Computers and Programming
Chapter 1: Introduction to Computers and Programming
Presentation transcript:

BASIC PROGRAMMING C SCP1103 (02) NORIZAM KATMON FSKSM N28-310-01 rizam@utm.my

Course Information Refer to course outline (L1)

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 – person who writes instructions (programs) to make computer perform a task SO, without programmers, no programs; without programs, a computer cannot do anything

Main hardware component categories: Central Processing Unit (CPU) Main Memory Secondary Memory / Storage Input Devices Output Devices

Main hardware component categories:

Central Processing Unit (CPU) Comprised of: Control Unit Retrieves and decodes program instructions Coordinates activities of all other parts of computer Arithmetic & Logic Unit Hardware optimized for high-speed numeric calculation Hardware designed for true/false, yes/no decisions

CPU organisation

Main memory It is volatile. Main memory is erased when program terminates or computer is turned off Also called Random Access Memory (RAM) Organized as follows: bit: smallest piece of memory. Has values 0 (off, false) or 1 (on, true) byte: 8 consecutive bits. Bytes have addresses.

Main memory Addresses – Each byte in memory is identified by a unique number known as an address. The number 149 is stored in the byte with the address 16, and the number 72 is stored at address 23.

Secondary storage Non-volatile: data retained when program is not running or computer is turned off Comes in a variety of media: magnetic: floppy disk, zip disk, hard drive optical: CD-ROM Flash drives, connected to the USB port

Input devices Devices that send information to the computer from outside Many devices can provide input: Keyboard, mouse, scanner, digital camera, microphone Disk drives and CD-ROM

Output devices Output is information sent from a computer program to the outside world. The output is sent to an output device Many devices can be used for output: Computer monitor and printer Floppy, zip disk drives Writable CD drives

Software – programs that run on a computer Categories of software: Operating system: programs that manage the computer hardware and the programs that run on them. Examples: Windows, UNIX, Linux Application software: programs that provide services to the user. Examples : word processing, games, programs to solve specific problems

Programs and programming languages A program is a set of instructions that the computer follows to perform a task We start with an algorithm, which is a set of well-defined steps.

Example algorithm for calculating gross pay

Machine language Although the previous algorithm defines the steps for calculating the gross pay, it is not ready to be executed on the computer. The computer only executes machine language instructions.

Machine language Machine language instructions are binary numbers, such as 1011010000000101 Rather than writing programs in machine language, programmers use programming languages.

Types of languages: Low-level: used for communication with computer hardware directly. Often written in binary machine code (0’s/1’s) directly. High-level: closer to human language

Some well-known programming languages

From a high-level program to an executable file Create file containing the program with a text editor. Run preprocessor to convert source file directives to source code program statements. Run compiler to convert source program into machine instructions. Run linker to connect hardware-specific code to machine instructions, producing an executable file. Steps b–d are often performed by a single command or button click. Errors detected at any step will prevent execution of following steps.

From a high-level program to an executable file Object Code Source Code Linker Preprocessor Modified Source Code Executable Code Compiler

Integrated Development Environments (IDEs) An integrated development environment, or IDE, combine all the tools needed to write, compile, and debug a program into a single software application. Examples are Microsoft Visual C++, Borland C++ Builder, CodeWarrior, etc.

Integrated Development Environments (IDEs)

What is a program made of? Common elements in programming languages: Key Words Programmer-Defined Identifiers Operators Punctuation Syntax Variables

Sample C code #include <stdio.h> int main(void) { printf("hello, world\n"); return 0; }

Input, processing and output Three steps that a program typically performs: Gather input data: from keyboard from files on disk drives Process the input data Display the results as output: send it to the screen write to a file

The programming process

Procedural and object-oriented programming Procedural programming: focus is on the process. Procedures/functions are written to process data. Object-Oriented programming: focus is on objects, which contain data and the means to manipulate the data. Messages sent to objects to perform operations.