Sie sind auf Seite 1von 38

CS113: Introduction to Programming

Samin Khaliq

Pre-requisites and Credit Hours
Pre-requisites: None

Credit Hours: 1 + 1
1 lecture per week
3 hours lab per week
2
Course Outline
Programming Language: C

Data types and operators

Statements and Control Flow

Declarations and Initialization

Functions

Basic I/O

Arrays


3
Textbook
Published by
W. W. Norton & Company
Reference Books

Object Oriented Programming in C++
Robert Lafore, 4
th
Edition



C How to Program
Dietel and Dietel, 6
th
Edition


Internet
Any book you find easy to read

Contact Details
Counseling hours
Thursday (1100 to 1300 hrs)

Email Address: samin.khaliq@seecs.edu.pk

Phone : 90852191

Office: A205, 1
st
floor, Faculty Block, SEECS



6
Evaluation Criteria
7
Theory (50%)
1. Quiz 10%
2. Assignments 10%
3. One Hour Test 1 (OHT 1) 15%
4. One Hour Test 2 (OHT 2) 15%
5. Final 50%

Practical (50%)
1. Lab Assignments 70%
2. Lab Exam 30%
Quiz
Announced
Unannounced

No best-of quizzes
All quizzes are counted towards the final result
Lab Work
Each lab will comprise of a lab exercise
Implementation of concepts studied during lectures

Lab assignment to be submitted individually

Programming Language: C

Programming Tools
MS Visual C++ 2012
9
Course Website
Primary source of information (LMS)
Lectures and Handouts
Assignments
Online submission
Grade Sheet


http://lms.nust.edu.pk/portal

Deadlines
All work is due on the due date

NO credit on LATE submission of any deliverable

If LMS is non-functional, e-mail the assignment

Excuses (no electricity, no internet connectivity)
will not be entertained


11
Plagiarism/cheating Policy
Zero Tolerance Policy
Collaboration / Group work encouraged
Submit work expressed in your own words
Always acknowledge help taken from other
sources
Cheating and plagiarism will not be tolerated
Referred to the Dean for appropriate action


12
Expectations
Attend all lectures and labs
Do programming assignments yourself
Learn the skill of debugging code yourself
The more mistakes you make, the more you learn

Practice, Practice, Practice



Questions

Todays lecture


15


Computers

Programming Language
History of Computing
Charles Babbage (1791-1871, Famous
mathematician, Professor at Cambridge
University, Chair of Newton)
1833 made a design of a computing device
Worlds first digital general purpose computer
Named Analytical Engine
A brilliant design
Could not be constructed during his time
Possible after 100 years of his design
Made in Harvard which was similar to his design
Father of the computer


Analytical Engine
Analytical Engine
A programmable mechanical digital
machine.
Nowadays our computers are all electronic. But
at that time electronics technology did not exist.
All the capabilities of todays modern computer
Computations
Make decisions: If-else
Input, storage, processor, output
They used to call the processor MILL like sugar mill.




Harvard Mark I (1943)
Ada (1815 1852)
Famous student of Charles Babbage
Ada (Mathematician)
Her fathers name was Byron who was a famous poet
Wrote a program for Babbages machine (considered
to be the first computer program)
Worlds first computer programmer
Language: Ada
US Dept. of defence designed this first language and
to honour her they named the language Ada.

Computer
What is a computer?

Why use a computer?

What value do computers bring to us?

What are computers good at?
Computer
The first use of the word "computer" recorded in
1613
A person who carried out calculations, or
computations
From the end of the 19th century onwards
though, the word began to take on its more
familiar meaning
A machine that carries out computations
A computer is a programmable machine that
receives input, stores and manipulates data, and
provides output in a useful format.

Advantages
Speed

Storage

Accuracy
Disadvantages
Data Security

Can computers think?

Come up with brand new innovative ideas

Repetitive strain injury

Impact on environment
Programming Languages
Programming Language
An artificial language used to write instructions
that can be translated into machine language
and then executed by a computer.

Programming languages can be used to create
programs that control the behaviour of a
machine and/or to express algorithms precisely.
28
Types of Programming Languages
Low Level Languages
1. Machine language (1GL)
Strings of numbers giving machine specific instructions
Example: Calculates nth Fibonacci number
8B542408 83FA0077 06B80000 0000C383
FA027706 B8010000 00C353BB 01000000
B9010000 008D0419 83FA0376 078BD98B
C84AEBF1 5BC3
2. Assembly language (2GL)
English-like abbreviations representing elementary
computer operations (translated via assemblers)
Example: fib:
mov edx, [esp+8]
cmp edx, 0
ja @f
mov eax,
0 ret
29
Types of Languages
3. High-level languages (3GL)
Codes similar to everyday English
Use mathematical notations (translated via
compilers)
Example:
grossPay = basePay + overTimePay
Languages:
C, C++, Java, FORTRAN, COBOL, Pascal


Development of programming languages

Development of Programming Languages
2000 C#
.
.
2001 Visual Basic .NET
.
.
2009 Go by Google Inc. (Similar to C)
.
.
2014 Swift (developed by Apple)

A brief history of C
Developed by Dennis M. Ritchie at AT&T Bell Labs
between 19691973 for UNIX
Descendant of Ken Thompsons language B
First published specification standard:
Ritchie and Brian Kernighan The C Programming Language in
1978
C-dialect now known as K&R-Style
Ease of portability language began to spread
A slightly modified version of K&R was standardised by
ANSI 1989
C-dialect now known as ANSI-C
The latest revision of the Standard is C99 (ISO)
ISO/IEC JTC1/SC22/WG14 is the international standardization
working group for the programming language C.
Dennis Ritchie and Ken Thompson

C and C++
C++ is descended from C
Written by Bjarne Stroustrup during 1983-1985
Originally called C with Classes
ISO/IEC JTC1/SC22/WG21 has produced the
standard ISO/IEC 14882:1998 on the
programming language C++
C and C++ are different languages
Why C / C++ ?
High level language
C is higher level than assembler but still close to the
hardware and allows direct manipulation of many
system aspects: pointers, memory allocation, bitwise
manipulation.
Widely used across the world
Portability - Programs can run on many different
computers
Fast
Structured (Extensive use of functions)

Tiobe Index (www.tiobe.com)
Internet Resources
Programming languages map
http://www.digibarn.com/collections/posters/tongu
es/tongues.jpg

Timeline of programming languages
http://en.wikipedia.org/wiki/Timeline_of_program
ming_languages

Das könnte Ihnen auch gefallen