CCSA 221 Programming in C CHAPTER 2 SOME FUNDAMENTALS 1 ALHANOUF ALAMR.

Slides:



Advertisements
Similar presentations
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Advertisements

Lecture 1: Overview of Computers & Programming
Copyright © 2002 W. A. Tucker1 Chapter 1 Lecture Notes Bill Tucker Austin Community College COSC 1315.
Programming Types of Testing.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Introduction to Computer Programming in C
Lecture 1: Intro to Computers Yoni Fridman 6/28/01 6/28/01.
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.
Introduction to Computer Programming CSC 1401: Introduction to Programming with Java Lecture 2 Wanda M. Kunkle.
Chapter 1 Introduction to C Programming. 1.1 INTRODUCTION This book is about problem solving with the use of computers and the C programming language.
Programming Introduction November 9 Unit 7. What is Programming? Besides being a huge industry? Programming is the process used to write computer programs.
Introduction to a Programming Environment
CMP 131 Introduction to Computer Programming Violetta Cavalli-Sforza Week 1, Lab.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Chapter 1 Introduction to Programming. Computer Hardware CPU Memory –Main or primary –Secondary or auxiliary Input device(s) Output device(s)
1 CHAPTER 4 LANGUAGE/SOFTWARE Hardware Hardware is the machine itself and its various individual equipment. It includes all mechanical, electronic.
CHAPTER 1: INTORDUCTION TO C LANGUAGE
1 I.Introduction to Algorithm and Programming Algoritma dan Pemrograman – Teknik Informatika UK Petra 2009.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
สาขาวิชาเทคโนโลยี สารสนเทศ คณะเทคโนโลยีสารสนเทศ และการสื่อสาร.
High level & Low level language High level programming languages are more structured, are closer to spoken language and are more intuitive than low level.
Chapter 1.4 Programming languages Homework Due: Monday, August 11, 2014.
Chapter 1 Introduction Dr. Frank Lee. 1.1 Why Study Compiler? To write more efficient code in a high-level language To provide solid foundation in parsing.
DEPARTMENT OF COMPUTER SCIENCE & TECHNOLOGY FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UWA WELLASSA 1 CST 221 OBJECT ORIENTED PROGRAMMING(OOP) ( 2 CREDITS.
Computer Programming A program is a set of instructions a computer follows in order to perform a task. solve a problem Collectively, these instructions.
Programming With C.
Chapter 1 Introduction to Computers and C++ Programming Goals: To introduce the fundamental hardware and software components of a computer system To introduce.
Introduction to Computer Programming in c
Getting Started with MATLAB 1. Fundamentals of MATLAB 2. Different Windows of MATLAB 1.
Problem Solving using the Science of Computing MSE 2400 EaLiCaRA Spring 2015 Dr. Tom Way.
IXA 1234 : C++ PROGRAMMING CHAPTER 1. PROGRAMMING LANGUAGE Programming language is a computer program that can solve certain problem / task Keyword: Computer.
Unit-1 Introduction Prepared by: Prof. Harish I Rathod
The LC-3 – Chapter 7 COMP 2620 Dr. James Money COMP
Chapter 1 Introduction Chapter 1 Introduction 1 st Semester 2015 CSC 1101 Computer Programming-1.
Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm.
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. Chapter 1 - Introduction 2 The Goal of Chapter 1 Introduce different forms of language translators Give a high level overview.
Overview of Previous Lesson(s) Over View  A program must be translated into a form in which it can be executed by a computer.  The software systems.
CHAPTER 1 INTRODUCTION 2 nd Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
Chapter 1 Computers, Compilers, & Unix. Overview u Computer hardware u Unix u Computer Languages u Compilers.
Chapter 1 : Overview of Computer and Programming By Suraya Alias
 Programming - the process of creating computer programs.
The Development Process Compilation. Compilation - Dr. Craig A. Struble 2 Programming Process Problem Solving Phase We will spend significant time on.
Chapter 11  Getting ready to program  Hardware Model  Software Model  Programming Languages  Facts about C++  Program Development Process  The Hello-world.
Lecture #1: Introduction to Algorithms and Problem Solving Dr. Hmood Al-Dossari King Saud University Department of Computer Science 6 February 2012.
PROGRAMMING FUNDAMENTALS INTRODUCTION TO PROGRAMMING. Computer Programming Concepts. Flowchart. Structured Programming Design. Implementation Documentation.
INTRODUCTION TO COMPUTER PROGRAMMING(IT-303) Basics.
Chapter 1: Introduction to Computers and Programming.
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.
Software Engineering Algorithms, Compilers, & Lifecycle.
System is a set of interacting or interdependent components forming an integrated whole.
Introduction to computer software. Programming the computer Program, is a sequence of instructions, written to perform a specified task on a computer.
Chapter 1 Introduction 2nd Semester H
Lecture 1b- Introduction
Assembler, Compiler, MIPS simulator
Operating System Interface between a user and the computer hardware
Programming languages
CSCI-235 Micro-Computer Applications
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Unit# 8: Introduction to Computer Programming
Computer Science I CSC 135.
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
Chapter 1 Introduction(1.1)
CS105 Introduction to Computer Concepts Intro to programming
CMP 131 Introduction to Computer Programming
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
ICS103 Programming in C 1: Overview of Computers And Programming
CHAPTER 6 Testing and Debugging.
Presentation transcript:

CCSA 221 Programming in C CHAPTER 2 SOME FUNDAMENTALS 1 ALHANOUF ALAMR

Some Fundamentals Outline: Programming Higher-Level Languages Operating Systems Compiling Programs 2

Programming Computers are really very dumb machines indeed because they do only what they are told to do. Most computer systems perform their operations on a very primitive level. For example, most computers know how to add one to a number or how to test whether a number is equal to zero. The basic operations of a computer system is called the computer’s instruction set. To solve a problem using a computer, you must express the solution to the problem in terms of the instructions of the particular computer. A computer program is just a collection of the instructions necessary to solve a specific problem. The approach or method that is used to solve the problem is known as an algorithm. 3

Programming -For example, if you want to develop a program that tests if a number is odd or even, the set of statements that solves the problem becomes the program. The method that is used to test if the number is even or odd is the algorithm. To develop a program to solve a particular problem, First, express the solution to the problem in terms of an algorithm. Then, develop a program that implements that algorithm. So, the algorithm for solving the even/odd problem: Divide the number by two. If the remainder of the division is zero, the number is even; otherwise, the number is odd. After you designed the algorithm, write the instructions necessary to implement this algorithm on a particular computer system. (i.e. Program) -These instructions would be expressed in the statements of a particular computer language, such as Visual Basic, Java, C++, or C. 4

Higher-Level Languages 5 When computers were first developed, the only way they could be programmed was in terms of binary numbers that corresponded directly to specific machine instructions and locations in the computer’s memory. Then the computers were advanced with the development of assembly languages, which enabled the programmer to work with the machine on a slightly higher level. The assembly language permits the programmer to use symbolic names to perform various operations and to refer to specific memory locations. A special program, known as an assembler, translates the assembly language program from its symbolic format into the specific machine instructions of the computer system.

6 Assembly languages are regarded as low-level languages because: 1-The programmer must learn the instruction set of the particular computer system to write a program because of one-to-one correspondence between each assembly language statement and a specific machine instruction. 2-The resulting program is not portable; that is, the program will not run on a different processor type without being rewritten. This is because different processor types have different instruction sets, and assembly language programs are written in terms of these instruction sets (i.e. machine dependent). Higher-Level Languages

7 Then, the higher-level languages were developed. FORTRAN (FORmula TRANslation) language was one of the first higher-level languages. One FORTRAN instruction or statement resulted in many different machine instructions being executed, unlike the one-to-one correspondence in assembly language. Standardization of the syntax of a higher-level language meant that a program could be written in the language to be machine independent. That is, a program could run on any machine that supported the language with few or no changes. In higher-level language, the compiler must be developed. A compiler is a special computer program that translates the statements of the program developed in the higher-level language into a form that the computer can understand ( i.e. the particular instructions of the computer).

Operating Systems 8 Operating system: a program that controls the entire operation of a computer system: -Handles all input and output (I/O) operations that are performed on a computer -Manages the computer system’s resources -Handles the execution of programs (including multitasking or multiuser facilities) Most famous OS families: -Windows -Unix

Compiling Programs 9 A compiler analyzes a program developed in a particular computer language and then translates it into a form that is suitable for execution on your particular computer system. The program that is to be compiled is first typed into a file on the computer system. C programs can typically be given any name provided the last two characters are “.c” ( e.g. prog1.c ). A text editor is usually used to enter the C program into a file. The program that is entered into the file is known as the source program because it represents the original form of the program expressed in the C language. After the source program has been entered into a file, you can then proceed to have it compiled.

10 Typical steps for entering, compiling, and executing C programs from the command line  Typical errors reported during compilation might be due to: 1-An expression that has unbalanced parentheses (syntactic error), or 2-The use of a variable that is not “defined” (semantic error). When all the syntactic and semantic errors have been removed from the program, the compiler then proceeds to take each statement of the program and translate it into a “lower” form (assembly language)

Compiling Programs 11 After the program has been translated into an equivalent assembly language program, the next step in the compilation process is to translate the assembly language statements into actual machine instructions (binary format known as object code). After the program has been translated into object code, it is ready to be linked. Linking means If the program uses other programs that were previously processed by the compiler, then during this phase the programs are linked together. The process of compiling and linking a program is often called building. The final linked file, which is in an executable object code format, is stored in another file on the system, ready to be run or executed.