Getting ready. Why C? Design Features – Efficiency (C programs tend to be compact and to run quickly.) – Portability (C programs written on one system.

Slides:



Advertisements
Similar presentations
Chapter 11 Introduction to Programming in C
Advertisements

ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Lecture 1: Overview of Computers & Programming
Copyright © 2002 W. A. Tucker1 Chapter 1 Lecture Notes Bill Tucker Austin Community College COSC 1315.
Systems Software.
1 CS 106, Winter 2009 Class 4, Section 4 Slides by: Dr. Cynthia A. Brown, Instructor section 4: Dr. Herbert G. Mayer,
COSC 120 Computer Programming
From: From:
B-1 Lecture 2: Problems, Algorithms, and Programs © 2000 UW CSE University of Washington Computer Programming I.
1 Lecture 1  Getting ready to program  Hardware Model  Software Model  Programming Languages  The C Language  Software Engineering  Programming.
Chapter 2: Impact of Machine Architectures What is the Relationship Between Programs, Programming Languages, and Computers.
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.
CS 104 Introduction to Computer Science and Graphics Problems Software and Programming Language (2) Programming Languages 09/26/2008 Yang Song (Prepared.
CHAPTER 1: INTORDUCTION TO C LANGUAGE
Introduction to Computer Software
COMPUTER SOFTWARE Chapter 3. Software & Hardware? Computer Instructions or data, anything that can be stored electronically is Software. Hardware is one.
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
“C” Programming Language What is language ? Language is medium of communication. If two persons want to communicate with each other, they have to use.
© 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.
UNIVERSITI TENAGA NASIONAL “Generates Professionals” CHAPTER 4 : Part 2 INTRODUCTION TO SOFTWARE DEVELOPMENT: PROGRAMMING & LANGUAGES.
1 Computing Software. Programming Style Programs that are not documented internally, while they may do what is requested, can be difficult to understand.
Chapter 2: Operating-System Structures. 2.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 2: Operating-System Structures Operating.
UNIT - 1Topic - 3. Computer software is a program that tells a computer what to do. Computer software, or just software, is any set of machine-readable.
Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why. Programmers combine theory and practice:
S2008Final_part1.ppt CS11 Introduction to Programming Final Exam Part 1 S A computer is a mechanical or electrical device which stores, retrieves,
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.
Basic of Programming Language Skill Area Computer System Computer Program Programming Language Programmer Translators.
C++ Basics C++ is a high-level, general purpose, object-oriented programming language.
Module 4 Part 2 Introduction To Software Development : Programming & Languages Introduction To Software Development : Programming & Languages.
L ECTURE -9 Topics : Compiler Interpreter Loader Linker. Types of Software..
Exam Format  105 Total Points  25 Points Short Answer  20 Points Fill in the Blank  15 Points T/F  45 Points Multiple Choice  The above are approximations.
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
Principles of Programming Chapter 1: Introduction  In this chapter you will learn about:  Overview of Computer Component  Overview of Programming 
The Instruction Set Architecture. Hardware – Software boundary Java Program C Program Ada Program Compiler Instruction Set Architecture Microcode Hardware.
Introduction to OOP CPS235: Introduction.
CS 1308 Exam 2 Review. Exam Format 110 Total Points 24 Points Short Answer 28 Points Fill in the Blank 16 Points T/F 36 Points Multiple Choice The above.
The Development Process Compilation. Compilation - Dr. Craig A. Struble 2 Programming Process Problem Solving Phase We will spend significant time on.
 Getting ready to code Lecture 1 Match 4, Course syllabus 
Chapter 11  Getting ready to program  Hardware Model  Software Model  Programming Languages  Facts about C++  Program Development Process  The Hello-world.
1 Asstt. Prof Navjot Kaur Computer Dept PRESENTED BY.
An overview of C Language. Overview of C C language is a general purpose and structured programming language developed by 'Dennis Ritchie' at AT &T's.
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.
INTRODUCTION TO COMPUTER PROGRAMMING(IT-303) Basics.
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.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
Software Engineering Algorithms, Compilers, & Lifecycle.
THE SOFTWARE Computers need clear-cut instructions to tell them what to do, how to do, and when to do. A set of instructions to carry out these functions.
Computer Basics.
DDC 2223 SYSTEM SOFTWARE DDC2223 SYSTEM SOFTWARE.
BASIC PROGRAMMING C SCP1103 (02)
Hardware and Software Hardware refers to the physical devices of the computer system e.g. monitor, keyboard, printer, RAM etc. Software is a set of programs,
BASIC PROGRAMMING C SCP1103 (02)
System Programming and administration
Computer 4 JEOPARDY Bobbie, Sandy, Trudy.
Instructor: Chien-Ho Ko
Microprocessor and Assembly Language
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
CSCI/CMPE 3334 Systems Programming
Teaching Computing to GCSE
Computer Science I CSC 135.
Computers: Hardware and Software
Types and components of a computer system
System Programming By Prof.Naveed Zishan.
ICS103 Programming in C 1: Overview of Computers And Programming
Presentation transcript:

Getting ready

Why C? Design Features – Efficiency (C programs tend to be compact and to run quickly.) – Portability (C programs written on one system can be run on other systems with little or no modification.) – Power and Flexibility (OS and programing languages are written in C.) – Programmer Oriented (It gives you access to hardware, and it enables you to manipulate individual bits in memory) – Shortcomings (you can make programming errors that are very difficult to trace)

Whither C? If you want a job writing software, one of the first questions you should be able to answer yes to is "Oh say, can you C?"

What Computers Do One consequence of how computers work is that if you want a computer to do something, you have to feed a particular list of instructions (a program) telling it exactly what to do and how to do it. 1.Copy the number in memory location 2000 to register 1. 2.Copy the number in memory location 2004 to register 2. 3.Add the contents of register 2 to the contents of register 1, leaving the answer in register 1. 4.Copy the contents of register 1 to memory location Register is a small amount of storage available as part of a CPU. Machine language

High-level Computer Languages and Compilers C simplify your programming life in several ways. First, you don't have to express your instructions in a numeric code. To add two numbers, for example, you might write the following: total = mine + yours; The compiler is a program that translates the high-level language program into the detailed set of machine language instructions the computer requires. total = mine + yours;

Using C: Seven Steps 1. Define the program objectives; 2. Design the program; 3. Write the code; 4. Compile; 5. Run the program; 6. Test and debug the program; 7. Maintain and modify the program.

Define the program objectives Start with a clear idea of what you want the program to do; Think in terms of the information your program needs; And the information the program should report back to you; Think in general terms, not in terms of some specific computer language.

Design the program What should the user interface be like? How should the program be organized? Who will the target user be? How much time do you have to complete the program? Think in general terms, not about specific code.

Write the Code Now that you have a clear design for your program, you can begin to implement it by writing the code. #include int main(void) { int dogs; printf("How many dogs do you have?\n"); scanf("%d", &dogs); printf("So you have %d dog(s)!\n", dogs); return 0; }

Compile The compiler is a program whose job is to convert source code into executable code; Executable code is code in the native language, or machine language, of your computer; C compilers also incorporate code from C libraries into the final program; the libraries contain a fund of standard routines, such as printf() and scanf(), for your use. (More accurately, a program called a linker)

Run the Program The executable file is a program you can run.

Test and Debug the Program The fact that your program runs is a good sign, but it's possible that it could run incorrectly; Some of your programs have mistakes—bugs; Debugging is the process of finding and fixing program errors; The compiler catches many kinds of errors, and there are things you can do to help yourself track down the ones that the compiler doesn't catch.

Maintain and modify the program You could add a clever new feature. You might adapt the program so that it runs on a different computer system. All these tasks are greatly simplified if you document the program clearly and if you follow sound design practices.

Programming Mechanics When you write a program in the C language, you store what you write in a text file called a source code file. Most C systems (MS Windows, Linux, etc) require that the name of the file end in.c (for example, wordcount.c and budget.c). The concrete.c Program #include int main(void) { printf("Concrete contains gravel and cement.\n"); return 0; }

Object Code Files, Executable Files, and Libraries The compiler converts your source code to an intermediate code (object code file), and the linker combines this with other code to produce the executable file. The object file contains machine language code, it is not ready to run; The first element missing from the object code file is something called startup code; The second missing element is the code for library routines The role of the linker is to bring together these three elements—your object code, the standard startup code for your system, and the library code—and put them together into a single file, the executable file.

Preparing a C program