CHAPTER 1: Programming Fundamentals CSEB113 PRINCIPLES of PROGRAMMING by Badariah Solemon 1BS (May 2013)

Slides:



Advertisements
Similar presentations
GCSE Computing Lesson 5.
Advertisements

CS101: COMPUTER PROGRAMMING Lecture 1: Introduction to Computer and Programming.
Creating a Program In today’s lesson we will look at: what programming is different types of programs how we create a program installing an IDE to get.
Lab6 – Debug Assembly Language Lab
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design First Edition by Tony Gaddis.
1 Lecture 1  Getting ready to program  Hardware Model  Software Model  Programming Languages  The C Language  Software Engineering  Programming.
Chapter 16 Programming and Languages: Telling the Computer What to Do.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. COMPSCI 125 Introduction to Computer Science I.
Programming Introduction November 9 Unit 7. What is Programming? Besides being a huge industry? Programming is the process used to write computer programs.
CMP 131 Introduction to Computer Programming Violetta Cavalli-Sforza Week 1, Lab.
An Introduction to Programming with C++ Fifth Edition Chapter 1 An Introduction to Programming.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Chapter 3 Software Two major types of software
Software Development Unit 6.
Course: Introduction to Computers
Activity 1 - WBs 5 mins Go online and spend a moment trying to find out the difference between: HIGH LEVEL programming languages and LOW LEVEL programming.
Microsoft Visual Basic 2012 CHAPTER ONE Introduction to Visual Basic 2012 Programming.
Microsoft Visual Basic 2005 CHAPTER 1 Introduction to Visual Basic 2005 Programming.
Programming In C++ Spring Semester 2013 Programming In C++, Lecture 1.
CS102 Introduction to Computer Programming
Principles of Programming Chapter 1: Introduction  In this chapter you will learn about:  Overview of Computer Component  Overview of Programming 
Introduction to Programming G50PRO University of Nottingham Unit 1 : Introduction Paul Tennent
1 Chapter-01 Introduction to Computers and C++ Programming.
Principles of Programming - NI July Chapter 1: Introduction In this chapter you will learn about: Overview of PC components The different types.
CHAPTER 4: INTRODUCTION TO COMPUTER ORGANIZATION AND PROGRAMMING DESIGN Lec. Ghader Kurdi.
Introduction COMP104: Fundamentals and Methodology.
“C” Programming Language What is language ? Language is medium of communication. If two persons want to communicate with each other, they have to use.
 2008 Pearson Education, Inc. All rights reserved Introduction to Computers, the Internet and World Wide Web.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
COMPUTER SOFTWARE Section 2 “System Software: Computer System Management ” CHAPTER 4 Lecture-6/ T. Nouf Almujally 1.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming 1.
Introduction CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
Programming With C.
Fundamental Programming: Fundamental Programming K.Chinnasarn, Ph.D.
Robert Crawford, MBA West Middle School.  Explain how the binary system is used by computers.  Describe how software is written and translated  Summarize.
INTRODUCTION TO COMPUTING CHAPTER NO. 04. Programming Languages Program Algorithms and Pseudo Code Properties and Advantages of Algorithms Flowchart (Symbols.
CSEB114: Principle of Programming Chapter 1: Introduction to Computer and Programming.
Basic of Programming Language Skill Area Computer System Computer Program Programming Language Programmer Translators.
1 TOPIC 1 INTRODUCTION TO COMPUTER SCIENCE AND PROGRAMMING Topic 1 Introduction to Computer Science and Programming Notes adapted from Introduction to.
Agenda Computer Languages How to Write a Simple C Program
CHAPTER 1: Introduction to Computers and Programming CSEB113 PRINCIPLES of PROGRAMMING CSEB134 PROGRAMMING I by Badariah Solemon 1BS (May 2012)
Principles of Programming Chapter 1: Introduction  In this chapter you will learn about:  Overview of Computer Component  Overview of Programming 
Course Instructor: Hira Farman Course : BY:HIRA FARMAN.
11 Computers, C#, XNA, and You Session 1.1. Session Overview  Find out what computers are all about ...and what makes a great programmer  Discover.
 Getting ready to code Lecture 1 Match 4, Course syllabus 
Principles of Programming CSEB134 : BS/ CHAPTER Fundamentals of the C Programming Language.
Lecture #1: Introduction to Algorithms and Problem Solving Dr. Hmood Al-Dossari King Saud University Department of Computer Science 6 February 2012.
1 Chapter 1 Background Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
Victoria Ibarra Mat:  Generally, Computer hardware is divided into four main functional areas. These are:  Input devices Input devices  Output.
INTRODUCTION TO COMPUTER PROGRAMMING ITC-314. Computer Programming  Computer Programming means creating a sequence of instructions to enable a computer.
Introduction to computer software. Programming the computer Program, is a sequence of instructions, written to perform a specified task on a computer.
Computer Basics.
CSCI-235 Micro-Computer Applications
Introduction to Visual Basic 2008 Programming
LESSON 1 Introduction to Programming Language
A451 Theory – 7 Programming 7A, B - Algorithms.
CHAPTER 1: Introduction to Computers and Programming
Teaching Computing to GCSE
TRANSLATORS AND IDEs Key Revision Points.
Teaching Computing to GCSE
Computers: Hardware and Software
CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING
CIS16 Application Development – Programming with Visual Basic
PROGRAMMING FUNDAMENTALS Lecture # 03. Programming Language A Programming language used to write computer programs. Its mean of communication between.
Tonga Institute of Higher Education IT 141: Information Systems
Tonga Institute of Higher Education IT 141: Information Systems
1.3.7 High- and low-level languages and their translators
Programming Logic and Design Eighth Edition
Presentation transcript:

CHAPTER 1: Programming Fundamentals CSEB113 PRINCIPLES of PROGRAMMING by Badariah Solemon 1BS (May 2013)

Topics 1.Computer Programs and Programming – Introduction – Why Do Engineering Undergraduates Need to Take Programming Course? 2.Programming Languages – Machine Language ; Assembly Language; High-level Language 3.The C Language – Your first C Program – C Programming Environment 2BS (May 2013)

COMPUTER PROGRAMS AND PROGRAMMING Topic 1 3BS (May 2013)

Elements of a Computer 4BS (May 2013) Hardware Software system software Application software

Computer and Software Computers can do a lot of exciting tasks. – However, computers must be given instructions in the form of computer programs before they can perform actions and make decisions. Software/program – a set of instructions stored inside a computer that allows the user to do a particular thing. 5BS (May 2013) Operating Systems Windows 8 Microsoft Word Application Software Utility Programs Disk Cleanup Language Translation Compiler System Software *Complete this list scanf( "%s", astring ); for ( i = 0; i < 10; ++i ) { if ( astring[i] == 'a' ) { printf( "You entered an a!\n" ); } scanf( "%s", astring ); for ( i = 0; i < 10; ++i ) { if ( astring[i] == 'a' ) { printf( "You entered an a!\n" ); } }

Computer programs that are embedded into hardware to control its operations. – Example: Telecommunication systems Consumer electronics Missiles and satellite Smart cards Medical equipment (e.g., electronic stetescope) and medical imaging (e.g. MRI, CT) Transportation systems BS (May 2013)6 Embedded Systems sscanf( "%s", astring ); for ( i = 0; i < 10; ++i ) { if ( astring[i] == 'a' ) { printf( "You entered an a!\n" ); } sscanf( "%s", astring ); for ( i = 0; i < 10; ++i ) { if ( astring[i] == 'a' ) { printf( "You entered an a!\n" ); }

What is Programming? Computer programming is: – not only about writing computer programs →the iterative process of designing, writing, testing, debugging, and maintaining the source code of computer programs This source code is written in one or more programming languages (such as C, C++, C#, Java, Python, Smalltalk, etc.) – often shortened to programming, scripting, or coding BS (May 2013)7

Why Should I Know Programming? “Everybody in this country should learn how to program a computer … because it teaches you how to think” – Steve Jobs BS (May 2013)8 Watch Me Source:

Why Take Programming Course? BS (May 2013)9 Programming is not only for computer science people only. Writing computer programs to solve complicated engineering problems and to control mechanical devices is a basic skill all engineers must master. Introductory programming course isn't trying to teach you to program so that you can be a programmer. Instead, such course just want you to think like programmers because in the future you will run into problems that are too long and complex to do by hand. In those cases, you'll have to use MATLAB or Mapple or mathworks or some other math related application that allows you to solve these problems. Unfortunately, if you can't code your problem into the application, it won't do you any good.

PROGRAMMING LANGUAGES Topic 2 10BS (May 2013)

What is a Programming Language? 1 Technically, it is an artificial language designed to communicate instructions to, or to control the behavior of a machine, particularly a computer. It is different from our everyday-language (natural language -NL) – NL : Depends on circumstances; the context – one word can have many meaning depending on the situation (e.g., OPERATE) – PL: Very specific (one word means one thing – context free) since to 'talk' to a computer; to instruct a computer; our commands must be 100% clear and correct. 11BS (May 2013)

What is a Programming Language? 2 Conceptually, programming language is a framework within which we organize our ideas about data and procedures. – Data: 'objects' or ‘things’ we want to manipulate – Procedures: 'descriptions' or 'rules' or ‘processes’ that define how to manipulate data – Example: A simple program that determine sum of two numbers – Data ? – Procedures? 12BS (May 2013)

Types of Programming Languages BS (May 2013) LOAD A, 9999 LOAD B, 8282 SUB B MOV C, A LOAD A, 9999 LOAD B, 8282 SUB B MOV C, A printf (“Hello”); total = quiz + assignment; printf(“Total = %d”, total); printf (“Hello”); total = quiz + assignment; printf(“Total = %d”, total); Machine Language High-Level Language Assembly Language

1. Machine Language The only language that is directly understandable by a computer’s processor. – Certainly difficult for humans to understand Consists of binary codes: 0 and 1. Example: is the language into which all programs must be converted before they can be run is generally machine dependent, as it varies from processor to processor (e.g., Intel, AMD and ARM processors) is NOT portable – program may sometimes have to be completely rewritten to work on different type of processors Programming in machine language is very slow and tedious since it is hard to memorize all the instructions and mistakes can happen very easily 14BS (May 2013)

2. Assembly Language Uses a mnemonic code to represent each machine operation – in words and numbers An intermediary language that can be understood by humans – but is still quite difficult to use Cannot be processed directly by a computer, must be converted to machine language using assemblers Although easier to use than machine language, programmer is required to have a complete understanding of the computer hardware in order to program it. To do simple tasks such as printing out a message, programmer needs to write a substantial amount of code. Processor dependent and not portable. 15BS (May 2013) LOAD A, 9999 LOAD B, 8282 SUB B MOV C, A LOAD A, 9999 LOAD B, 8282 SUB B MOV C, A Assembler

3. High-level Languages 1 Use more English words so easier to program in these languages. Example: The programming structure is problem oriented – does not need to know how the computer actually executes the instructions. Processor independent - the same code can be run on different processors. Programs written in these languages must be translated into executable machine language using – Compilers – translate instructions to create executable form – Interpreters – translate and execute instructions one after another 16BS (May 2013) printf (“Hello”); total = quiz + test + assignment; printf (“Hello”); total = quiz + test + assignment;

3. High-level Languages 2 Example: All have set of rules called syntax – must be followed – describe the form of a valid program and to get an accurate translation into machine language 17BS (May 2013) C PHPRubyAda JavaVisual BasicVisual Basic.NETMATLAB Objective-CPythonLISPLua C++PerlPascalBash C#JavascriptDelphiFORTRAN

THE C LANGUAGE Topic 3 18BS (May 2013)

The C Language 1 It was developed by Dennis Ritchie in the early 1970s at Bell Laboratories (now a part of Lucent Technologies, Inc). A high-level language that is highly portable. C combines the power of high-level languages with the power of assembly languages. It has influenced the newly created high-level language name Objective-C – which is the main programming language used by Apple for the OS X and iOS operating systems and their respective APIs, Cocoa and Cocoa Touch frameworks. 19BS (May 2013)

The C Language 2 C is a highly imperative programming language. This means: – It expresses what the program should accomplish by prescribing how to do it in terms of sequences of actions to be taken. – It was designed to be compiled using a relatively straightforward compiler. The language has become available on a very wide range of platforms, from embedded microcontrollers to supercomputers. 20BS (May 2013)

Your First C Program A C program (also called C source code): It must be translated into machine language. Once the machine language is executed, the program produces an output: BS (May 2013)21 /********************************************************** Author: Badariah Solemon Date: 01/01/2013 Description: A program that prints the famous “Hello World” message on the computer screen **********************************************************/ #include void main (void) { printf(“****************\n”); printf(“ Hello World\n”); printf(“****************\n”); } **************** Hello World ****************

C Programming Environment A modern C programming often made easy by the use of integrated development environments (IDEs). IDEs that support C language include Microsoft Visual Studio, Eclipse, and etc. Ms Visual Studio 2010 Express or Ms Visual Studio Express 2012 is free! – Highly recommended for your personal use – You must register to obtain a free product key for ongoing use BS (May 2013)22

Visual Studio C++ Express BS (May 2013)23

Summary Computers must be given instructions in the form of computer programs before they can perform actions and make decisions. Programming is the iterative process of designing, writing, testing, debugging, and maintaining the source code of computer programs. Conceptually, programming language is a framework within which we organize our ideas about data (object we want to manipulate) and procedures (how to manipulate the data). In general, programming languages may be categorized as 1) machine language (also called machine code), 2) assembly language, and 3) high- level languages. C is a highly imperative programming language. A modern C programming often made easy by the use of integrated development environments (IDEs). BS (May 2013)24