Fundamentals of Programming. Lecture 1: Introduction to C Programming

Similar documents
by Pearson Education, Inc. All Rights Reserved.

Basic Computer Programming for ISNE. Santi Phithakkitnukoon ผศ.ดร.ส นต พ ท กษ ก จน ก ร

C++ Programming Language Lecture 1 Introduction

Chapter 1 Introduction to Computers and C++ Programming

CS 241 Computer Programming. Introduction. Teacher Assistant. Hadeel Al-Ateeq

0 Introduction: Computer systems and program development

Introduction to Computers and Visual Basic.Net Pearson Education, Inc. All rights reserved.

Fundamentals of Programming (Python) Basic Concepts. Ali Taheri Sharif University of Technology Spring 2018

Fundamentals of Programming (C)

Introduction to Computers, the Internet and the Web Pearson Education, Inc. All rights reserved.

INTRODUCTION TO THE COURSE

Instructor. Mehmet Zeki COSKUN Assistant Professor at the Geodesy & Photogrammetry, Civil Eng. (212)

Chapter 1 Overview of Programming and Problem Solving By C.K. Liang

(0) introduction to the course. how to learn a programming language. (0) course structure

Fundamentals of Programming Session 2

Introduction to C++ Programming. Adhi Harmoko S, M.Komp

IS 0020 Program Design and Software Tools

Chapter 1 Introduction to Computers and C++ Programming

Fundamentals of Programming Session 1

Chapter 1: Introduction to Computers and Programming

CHAPTER 1: INTRODUCTION TO COMPUTERS AND PROGRAMMING. 1 Muhalim Mohamed Amin Faculty of

These all slide pages are selected from C How to Program, 5/e and 7/e Asst.Prof.Dr.Mahmut YALCIN

Fundamentals of Programming Session 1

Chapter 1: An Overview of Computers and Programming Languages. Objectives. Objectives (cont d.) Introduction

BITG 1113: Introduction To Computers And Programming Language LECTURE 1 LECTURE 1 1

Chapter 1: Why Program? Main Hardware Component Categories 8/23/2014. Main Hardware Component Categories: Why Program?

Chapter 1. Computer Technology Concept of Programming & Algorithm and Flow Charts

SCSP Programming Technique C

INFS 214: Introduction to Computing

C H A P T E R 1. Introduction to Computers and Programming

Programming 1. Lecture 1 COP 3014 Fall August 28, 2017

C++ Spring Break Packet 11 The Java Programming Language

Computer Fundamentals

Introduction. Arizona State University 1

! Learn how to think like a computer scientist. ! Learn problem solving. ! Read and write code. ! Understand object oriented programming

Chapter 1: Why Program? Computers and Programming. Why Program?

Spring 2018 NENG 202 Introduction to Computer Programming

Chapter 1 Introduction to Computers and C++ Programming

Object Oriented Concepts and Programming (CSC244) By Dr. Tabbasum Naz

Administration Computers Software Algorithms Programming Languages

Introduction to Computers

Introduction to Computing using C++ Biomedical applications WELCOME TO CIS 1.5. Introduction to the course. Course structure

Computer Programming-1 CSC 111. Chapter 1 : Introduction

CS120 Computer Science I. Instructor: Jia Song

Week 0: Intro to Computers and Programming. 1.1 Why Program? 1.2 Computer Systems: Hardware and Software. Hardware Components

1a Computers, Problem Solving!

EL2310 Scientific Programming

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.

CSCE150A. Administrivia. Overview. Hardware. Software. Example. Program. Pseudocode. Flowchart. Control Structures. Hello World Program CSCE150A

Computer Science & Engineering 150A Problem Solving Using Computers

Unit 1: Introduction to Programming. Saurabh Khatri Lecturer Department of Computer Technology VIT, Pune

Chapter 1: Introduction

Welcome (back) to CS1007!

Introduction to Java Programming

Computer Architecture. Fall Dongkun Shin, SKKU

CSS331 Lecture Notes: Dr. Isaac Gang, 2011.

Problem Solving and Program Design - Chapter 1. Cory L. Strope

Topics. Hardware and Software. Introduction. Main Memory. The CPU 9/21/2014. Introduction to Computers and Programming

Introduction to Basis and Practice in Programming

Week 1 Introduction to Programming

Introduction to Programming

Structured Languages. Rahul Deodhar

BIL 104E Introduction to Scientific and Engineering Computing. Lecture 1

Introduction to Computers and the Internet Pearson Education, Inc. All rights reserved.

last time in cs recitations. computer commands. today s topics.

Lecture 1: Preliminaries

C Programming for Engineers Introduction

Programming 1 - Honors

Chapter 1 & 2 Introduction to C Language

CS2303 C14 Systems Programming Concepts. Bob Kinicki

EKT 120/4 Computer Programming KOLEJ UNIVERSITI KEJURUTERAAN UTARA MALAYSIA

Chapter 1 INTRODUCTION

CS Prof J.P.Morrison

CS150 Introduction to Computer Science 1. What is CS150? Who Are We? CS150 is a programming course You will learn

ENT 189: COMPUTER PROGRAMMING. H/P: Home page:

Week 1 Introduction to Computer and Algorithm (Part1) UniMAP Sem II 11/12 DKT121: Basic Computer Programming 1

Introduction to Programming

1.The First Instrument known in the history of computers was. a) Pascal s adding machine b) Napier s bones c) Abacus d) Analytical Engine

ITC213: STRUCTURED PROGRAMMING. Bhaskar Shrestha National College of Computer Studies Tribhuvan University

Computer is an electronic machine that can receive, store, transform and output data of all kinds (image, text, numeric, graphics and sound).

Programming Fundamentals (CS 302 ) Dr. Ihsan Ullah. Lecturer Department of Computer Science & IT University of Balochistan

A software view. Computer Systems. The Compilation system. How it works. 1. Preprocesser. 1. Preprocessor (cpp)

CS 1713 Introduction to Computer Programming II Ch 0 Overview - Problem solving

The component base of C language. Nguyễn Dũng Faculty of IT Hue College of Science

Introduction to Computers and Java. Objectives. Outline. Harald Gall, Prof. Dr. Institut für Informatik Universität Zürich.

Introduction to Computers and Java

Class Note #02. [Overall Information] [During the Lecture]

CHAPTER 1 Introduction to Computers and Java

Introduction to Computers and Java

PROGRAMMAZIONE I A.A. 2017/2018

Introduction to Computer Systems

Object Oriented Design

Chris Riesbeck, Fall Introduction to Computer Systems

Elements of Computers and Programming Dr. William C. Bulko. What is a Computer?

Problem Solving With C++ Ninth Edition

1 EEE1008 C Programming

CISC 124: Introduction To Computing Science II

Introduction to Computers and Java. Objectives. Outline. Harald Gall, Prof. Dr. Institut für Informatik Universität Zürich.

CSI31 Introduction to Computer Programming I. Dr. Sharon Persinger Fall

1/14/2014. Introduction to CSE 1325 Object Oriented Programming (Using Java) Introduction (Cont.) Introduction

Transcription:

1

Fundamentals of Programming Lecture 1: Introduction to C Programming Instructor: Fatemeh Zamani f_zamani@ce.sharif.edu Sharif University of Technology Computer Engineering Department 2

Outline Grading Policy What is a computer? Computer Organization Languages History of C Typical C Program Development 3

Text Book C: How to Program (6th Edition) Deitel & Deitel 4

Grading Policy 6 Programming Assignments At least 4 quiz Project (Two Phases) Midterm Exam Final Exam Extra Points (TA Classes) 4 points 2 points 3 points 4 points 7 points +1 point 5

What is a computer? A computer is a device that can perform computations and make logical decisions billions of times faster than human beings can. Many of today s personal computers can perform several billion additions per second. Computers process data under the control of sets of instructions called computer programs. 6

What is a computer? (Cont.) Hardware keyboard, screen, mouse, hard disk, memory, DVDs and processing units. Software The programs that run on a computer. you ll learn proven methods that are: reducing software development costs structured programming (in the C chapters) object-oriented programming (in the C++ chapters). 7

Computer Organization 1- Input unit This receiving section obtains information (data and computer programs) from input devices. keyboards mouse devices speaking to your computer scanning images and barcodes reading from secondary storage devices - hard drives, CD drives, DVD drives and USB drives, information from the Internet 8

Computer Organization (Cont.) 2- Output unit Takes information that the computer has processed and places it on various output devices. displayed on screens printed on paper played on audio players used to control other devices output their information to networks 9

Computer Organization (Cont.) 3- Memory unit rapid-access relatively low-capacity It s typically lost when the computer s power is turned off. 10

Computer Organization (Cont.) 4- Arithmetic and logic unit (ALU) performs calculations addition, subtraction, multiplication and division the decision mechanisms In today s systems, the ALU is usually implemented as part of the CPU. 11

Computer Organization (Cont.) 5- Central processing unit (CPU) administrative section. The CPU tells the input unit when to read information into the memory unit, tells the ALU when information from the memory unit should be used in calculations and tells the output unit when to send information from the memory unit to certain output devices. Many of today s computers have multiple CPUs (multiprocessors) dual-core processor has two CPUs and a quad-core processor has four CPUs. 12

Computer Organization (Cont.) 6- Secondary storage unit long-term high-capacity takes much longer to access than information in primary memory the cost per unit of secondary storage is much less than that of primary memory. Examples of secondary storage devices include: CDs DVDs flash drives 13

Computer Organization (Cont.) 14

Machine Languages, Assembly Languages and High-Level Languages Computer languages may be divided into three general types: Machine languages Assembly languages High-level languages 15

Machine Languages, Assembly Languages and High-Level Languages (Cont.) Any computer can directly understand only its own machine language. defined by its hardware design. Machine language is often referred to as object code. Machine languages generally consist of strings of numbers (ultimately reduced to 1s and 0s) This code in Machine Language adds overtime pay to base pay and stores the result in gross pay: +1300042774 +1400593419 +1200274027 16

Machine Languages, Assembly Languages and High-Level Languages (Cont.) Programmers began using English-like abbreviations to represent elementary operations. These abbreviations formed the basis of assembly languages. Translator programs called assemblers were developed to convert early assembly-language programs to machine language at computer speeds. This code in Assembly Language adds overtime pay to base pay and stores the result in gross pay: load basepay add overpay store grosspay 17

Machine Languages, Assembly Languages and High-Level Languages (Cont.) high-level languages were developed in which single statements could be written to accomplish substantial tasks. Translator programs called compilers convert high- level language programs into machine language. Instructions that look almost like everyday English and contain commonly used mathematical notations. This code in Assembly Language adds overtime pay to base pay and stores the result in gross pay: grosspay = basepay + overtimepay; 18

Machine Languages, Assembly Languages and High-Level Languages (Cont.) C, C++, Microsoft s.net languages (e.g., Visual Basic, Visual C++ and Visual C#) and Java are among the most widely used highlevel programming languages. Interpreter programs were developed to execute high-level language programs directly (without the delay of compilation), although slower than compiled programs run. 19

History of C C evolved from two previous languages, BCPL and B. BCPL was developed in 1967 by Martin Richards as a language for writing operating-systems software and compilers. Ken Thompson modeled many features in his B language after their counterparts in BCPL, and in 1970 he used B to create early versions of the UNIX operating system at Bell Laboratories. The C language was evolved from B by Dennis Ritchie at Bell Laboratories. 20

Typical C Program Development C programs typically go through six phases to be executed 1. Edit 2. Preprocess 3. Compile 4. Link 5. Load 6. Execute. 21

Typical C Program Development (Cont.) 1- Editor You type a C program with the editor, make corrections if necessary, then store the program on a secondary storage device such as a hard disk. C program file names should end with the.c extension. 22

Typical C Program Development (Cont.) 2- Preprocessor The C preprocessor obeys special commands called preprocessor directives. including other files in the file to be compiled performing various text replacements 23

Typical C Program Development (Cont.) 3- Compiler The compiler translates the C program into machine-language code. 4- Linker A linker links the object code with the code for the missing functions to produce an executable image (with no missing pieces). 24

Typical C Program Development (Cont.) 5- Loader Before a program can be executed, the program must first be placed in memory. Additional components from shared libraries that support the program are also loaded. 6- Executer The computer, under the control of its CPU, executes the program one instruction at a time. 25

Typical C Program Development (Cont.) 26

Typical C Program Development (Cont.) 27

While you study Read Chapter one carefully from text book, 28