Sie sind auf Seite 1von 25

CS102/CSC111: Programming Fundamentals (Semester: Spring 2012)

By: Asadullah Shaikh

y Do not use work from uncited sources. y Default penalty: F

y Welcome to visit me in my office. y 5 min late y y y y y

attendance will be marked as late 10 min late I will not allow the student in class No compromise on the deadlines. Hard copy will submitted for each work. Only two person will be in group. Disturbance will not allowed during lecture.

y Introduce Your Self. y Your Name, Your Background, Schooling. y Your Aims in Life. y Are you interested in research? y What is PhD?

y All class materials will be on the web using the

link: www.asadshaikh.com/pf
y y

Lecture notes, handouts, papers to read, etc. So why should you come to lecture then?

y You can always ask questions from me. y The best way to communicate with me is through

email. My email address is asadullah@biztekian.org

y A good coder can never stop thinking. y You will enjoy when you create your

first computer program

y It s like art: y Your project is your baby.


y It ll keep you up at night, make you proud

It s like engineering

Course Name Course Code Credit Hours

Programming Fundamentals CS-102/CSC-111 3 credit hours / 2+1 class hours (per week) Spring(2012) Asadullah Shaikh UAN: 111-428-428 Ext. (139) Friday (11 AM 12 PM) asadullah@biztekian.com

Course Prerequisites None Quarter/Year Instructor Contact Number Consultation Hours Email

y Let us discuss the tentative outline now? y The final outline will be provided soon.

Course Objectives
y The course is designed to familiarize students with the

basic structured programming skills. It tries to acquaint students with problem analysis, algorithm designing, and program development and testing.
y Concepts and principles of problem solving y Construction of algorithms to solve problems y Principles underlying the design of a programming language y Experience & Confidence in the use of programming language to

implement algorithms

Course Description/Outline
y Overview of computer programming and

programming language

y Building blocks (variable types, input and output

functions, arithmetic and relational operators)

y Fundamental programming constructs y Sequence (statements, blocks) y Selection (if switch) y Iteration (loops like while and for) y Functions, Arrays, Strings, Structures and Unions

Course Description/Outline (cont.)


y Analyzing problem y Basics of algorithms and problem solving y Development of basic algorithms y Translation of algorithms into computer programs

By the completion of this course, student would be able to analyze, construct, and execute simple computer programs in C programming language LO1: Understand basics (Introduction, basic concepts of C language) LO2: Understand loops and decisions LO3: Construct small functions in C language LO4: Understand advance concepts (pointers and filing)

TEXTBOOK(S) 1. Turbo C, Programming for the PC and Turbo C++, By Robert Lafore (Publisher SAMS) 2. Let us C, By Yashwant Kanitkar (BPB Publications)

REFERENCE BOOK(S) 1. C How to Program, By Deitel and Deitel, Prentice Hall

Assessment Tools Assignments Quizzes Midterm Exam Class Participation Final

Marks/Poin ts 15 10 20 05 50

LO Covered LO 1,2,3,4 LO 1,2,3,4 LO 1,2 LO 2,3,4 LO 1,2,3,4

Lecture 1 (Session 1)
Introduction History of C C Programming Environment

What is computer program ?


It is set of instructions to a computer to perform a specific task. It is usually written in human readable source code style.

What is a source code?


It is written text of a programming language

What is computer programming ?


In simple words, it is the designing, penning, testing, debugging, and maintaining code of a program. Designing: Problem solving and planning a solution Penning: Writing in the form of source code Testing: Judging the quality and risk of implementation Debugging: Finding errors or bugs in a program

What is a programming language?


It is a language used to transfer human instructions into a machine such as computer. A programming language has: Syntax (the surface form, usually textual) Semantics (the meaning)

What is an algorithm ?
Simply, the step-by-step sequence of instructions that describe how the data is to be processed to produce the desired output

What is C?
A programming language developed by Dennis Ritchie at Bell Labs. The language that UNIX was written in to become the first "portable" language. In 1980s, the American National Standards Institute (ANSI) standardized C. The ANSI standard, or "ANSI C .

Why to still use C?


Provide convenience of high-level language Allows access to computer s hardware and peripherals (like assembly language does) Very few operations that cant be done in C but in assembly C compiler generates very fast and efficient code Well-structured language : (easy to understand and maintain) Portable (easier to transfer programs for other machines)

Turbo C Development System


Two development environments
Integrated Development Environment (IDE) (Borland Turbo C++ etc.) Command-Line Development Environment

Types of files in C Program Development


Executable Files (comand line compiler, linker etc.) Library Files (contain routines/functions) Runtime Object Files Header Files (include files, compiler directives)

Phases of C Programs:
Editor Preprocessor Compiler Linker Disk Disk Disk Disk Memory Loader

1. Program is created in the editor and stored on disk 2. Preprocessor program processes the directives etc. 3. Compiler creates object code and stores it on disk. 4. Linker links the object code with the libraries

1. Edit 2. Preprocess 3. Compile 4. Link 5. Load 6. Execute

5. Loader puts program in memory.


Disk

Memory CPU

6. CPU takes each instruction and executes it, possibly storing new data values as the program executes

Taken From: ``Evolution and history of programming languages

myprog.c SOURCE

myprog.obj OBJECT

myprog.exe EXECUTABLE

written in C

written in machine language

written in machine language

via compiler

via linker
other code from libraries, etc. (also in machine language)

void main(void) {

//My First Program

printf(``This is my first program``);


}

Functions are units of a program A ``C`` program contains one or more functions When a program is execcuted control is transferred to main() function

Das könnte Ihnen auch gefallen