Senem Kumova Metin 2010-2011 Introduction to Programming CS 115 Introduction to Computing PART I : Computer Basics PART II: Introduction to Computing/Programming.

Slides:



Advertisements
Similar presentations
EC-111 Algorithms & Computing Lecture #1 Instructor: Jahan Zeb Department of Computer Engineering (DCE) College of E&ME NUST.
Advertisements

Senem Kumova Metin // FALL CS115 Introduction to Programming Inst. Senem Kumova Metin Textbook : A Book on C, A. Kelly.
CS115 Introduction to Programming
Lecture 1: Overview of Computers & Programming
Overview of Programming and Problem Solving ROBERT REAVES.
 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
Engineering Problem Solving With C++ An Object Based Approach Fundamental Concepts Chapter 1 Engineering 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.
Chapter 1- Visual Basic Schneider1 Chapter 1 An Introduction to Computers and Visual Basic.
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
Introduction to Computers and Python. What is a Computer? Computer- a device capable of performing computations and making logical decisions at speeds.
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.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
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.
CISC105 General Computer Science Class 1 – 6/5/2006.
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.
Intro to Computers Computer Apps 1.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Introduction Lecture 01.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages.
Mrs. Ulshafer August, 2013 Java Programming Chapter 1.
Intro to Computers Computer Applications. What is a Computer? Initially the term computer referred to an individual whose job it was to perform mathematical.
1 Programming Fundamentals How to Program in C++ How to Program in C++
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 Computers, Compilers, & Unix. Overview u Computer hardware u Unix u Computer Languages u Compilers.
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
A.Abhari CPS1251 Topic 1: Introduction to Computers Computer Hardware Computer components Connecting Computers Computer Software Operating System (OS)
Senem KUMOVA METİN // Fall CS 115 Introduction to Programming Introduction to Computing.
Chapter 1 Introduction to Computers, the Internet and the Web.
Brief Version of Starting Out with C++ Chapter 1 Introduction to Computers and Programming.
Chapter 11  Getting ready to program  Hardware Model  Software Model  Programming Languages  Facts about C++  Program Development Process  The Hello-world.
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.
Introduction to Computer Programming using Fortran 77.
1 Types of Programming Language (1) Three types of programming languages 1.Machine languages Strings of numbers giving machine specific instructions Example:
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.
Introduction To Computer Programming – 1A Computer Parts, Words, and Definition Herriman High School.
Chapter 1: Introduction to Computers and Programming
Chapter 1 Introduction 2nd Semester H
Java Programming: From the Ground Up
BASIC PROGRAMMING C SCP1103 (02)
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)
COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE
Introduction to Programming
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
Computer Electronic device Accepts data - input
Computers: Hardware and Software
Computer Electronic device Accepts data - input
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
Computer Electronic device Accepts data - input
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
Computer components is a programmable machine that receives input, stores and manipulates data, and provides output in a useful format. Computer The computer.
Presentation transcript:

Senem Kumova Metin Introduction to Programming CS 115 Introduction to Computing PART I : Computer Basics PART II: Introduction to Computing/Programming

Senem Kumova Metin PART I : Computer Basics Contents Computer basics Hardware & software Hardware components

Senem Kumova Metin What is a Computer? A computer is a machine that manipulates data according to a list of instructions Simply a computer 1. takes information (or inputs) 2. processes it according to a set of instructions (a program) 3. gives back a result (or output)

Senem Kumova Metin Computing Activity of using and developing computer technology, computer hardware and software. Hardware –a general term that refers to the physical artifacts of a technology Software –a general term used to describe a collection of computer programs, procedures and documentation that perform some tasks on a computer system

Senem Kumova Metin Key components of a Computer

Senem Kumova Metin Key components of a Computer Input Devices –Receiving sections of computer –Allow the user to control the machine –Examples : Keyboard Mouse Microphone Scanner Etc..

Senem Kumova Metin Key components of a Computer Output Devices –Return the results of computer actions back to the user –Examples : Monitor Speakers Printer

Senem Kumova Metin Key components of a Computer CPU ( Central Processing Unit) –‘brain’ of the computer –Follows the instructions provided by both the user (via input devices) and the program that is running in order to perform a task – Involves a control unit, ALU (Arithmetic Logic Unit), registers...

Senem Kumova Metin Key components of a Computer Memory –Internal storage areas in the computer –Retains information that has been entered through the input unit so that the information may be made available for processing when needed. –RAM and ROM RAM - Random access memory: whose contents can be accessed (read, write and remove) in any order ROM - Read-only memory: On ROM, data is prerecorded for read only which can not be removed

Senem Kumova Metin Key components of a Computer Secondary Storage –Long term high capacity warehousing part of the computer –Store both the programs that run on the system as well as the work that is created –The most common storage device is a fixed magnetic disk that sits inside the machine and this is called the hard drive –Examples: hard disk, CD,DVD and flash drives

Senem Kumova Metin PART II : Introduction to Computing/Programming Contents Computer programming Flow of Control Programming languages Programming in C

Senem Kumova Metin WHAT is PROGRAMMING?? scheduling or performing a task or / and event WHAT is COMPUTER PROGRAMMING?? creating a sequence of steps for a computer to follow in performing a task

Senem Kumova Metin WHAT is a PROGRAMMING LANGUAGE ? A set of rules, symbols, and special words used to construct a computer program

Senem Kumova Metin Programming language rules consist of –Rules of Syntax which specify how valid instructions are written in the language ( natural language rule  subject + verb +object ) –Rules of Semantics which determine the meaning of the instructions (what the computer will do) ( A book has bitten a car )

Senem Kumova Metin Programming Languages Machine Languages Assembly Languages High Level Languages

Senem Kumova Metin Machine Language Machine dependent Machine code is a set of instructions that a computer's central processing unit (CPU) can understand and obey directly, without any translation. Machine-code programs consist entirely of binary digits (bits). BIT ?? BYTE??

Senem Kumova Metin Assembly Language First attempt at producing a mechanism for writing programs that was more palatable to ourselves A program written in assembly code, in order to “run”, must first be translated (assembled) into machine code.

Senem Kumova Metin High Level Languages A more problem-oriented (rather than machine-oriented) mechanism for creating computer programs would also be desirable Hence the advent of high(er) level languages starts with the introduction of “Autocodes”, and going on to Algol, Fortran, Pascal, Basic, Ada, C, etc Interpreted or compiled

Senem Kumova Metin Machine Language Assembly Language Load basePay Add overTimePay Store grossPay High level Language grossPay= basePay+overTimePay

Classification of High level Programming languages Programming paradigm : Alternative approaches to the programming process –Functional (Lisp, ML) –Object-Oriented (C++, Java) –Imperative (Procedural) (Fortran, Algol, Pascal, Basic, C) –Declarative (Prolog,GPSS) Senem Kumova Metin

High Level Languages Interpreted –Interpreted Languages are read and then executed directly, with no compilation stage. Compiled –Compiled Languages are transformed into an executable form before running.

Senem Kumova Metin ASSEMBLY versus HIGH LEVEL LANGUAGE HelloWorld.asm Source Code HelloWorld.c Source Code Machine Code (binary) Object Code assembled compiled Library (stdio.h) linked

Senem Kumova Metin Compilation Process

Senem Kumova Metin High Level Languages: Libraries Libraries (in computer programming terms) contain chunks of precompiled (object) code for various functions and procedures that come with a programming language that requires compilation For example functions and procedures to facilitate I/O

Senem Kumova Metin Flow of Control The execution sequence of a group of machine instructions is known as the flow of control.

Senem Kumova Metin EXAMPLE 1: Flow of Control SCENARIO : we have 2 integers : x, y multiply x with y store the result in x print the value of x int x and int y x = x*y print x

Senem Kumova Metin EXAMPLE 2: Flow of Control SCENARIO : we have 2 integers : x,y if x is greater than 0 then do x= y+1; else do x= y-1; print the value of x int x and int y x > 0 YESNO x = y+1 x = y-1 print x

Senem Kumova Metin Why C? Native language of UNIX (a famous operating system) Standard development language for personal computers Portable (can be moved to other machine !) Powerful set of operators and powerful libraries (some operators: ++,--….) Basis for Java, C++…..

Senem Kumova Metin First C program – Basic I/O functions : printf / scanf – Including libraries – Writing comments – Defining variables ….

Senem Kumova Metin Basic I/O Functions: printf #include // library file void main(void) { printf("from sea to shining C\n"); } // Print a string of characters to the screen

Senem Kumova Metin Basic I/O Functions: printf #include void main(void) { printf("from sea ”); printf(“to shining C\n"); }

Senem Kumova Metin Basic I/O Functions && Defining a variable #include // library file void main(void) { int x=0; // an integer variable is defined and it is // initialized to 0 printf(“%d“, x); // print current value of variable x as a decimal value }

Senem Kumova Metin Basic I/O Functions : scanf #include void main(void) { int x=0; printf(“%d\n”, x); // print x as a decimal value scanf(“%d”,&x); // read a decimal value from keyboard, store it in x printf(“%d\n”, x); // print x as a decimal value }