Programming In C++ - EDUCATION CONSULTANT

Download Report

Transcript Programming In C++ - EDUCATION CONSULTANT

Programming In C++
Spring Semester 2013
Programming In C++, Lecture 1
Umer Aziz Rana
MSc.IT (London, UK)
Contact No. 0335-919 7775
[email protected]
Programming In C++, Lecture 1
EDUCATION CONSULTANT
Contact No.
0335-919 7775,
0321-515 3403
www.oeconsultant.co.uk
Programming In C++, Lecture 1
TELL ME ABOUT YOUR SELF
•
•
•
•
Name
Background Study
Why you chosen this course
What is your career goals
Programming In C++, Lecture 1
What Is Programme?
Programming In C++, Lecture 1
What Is Language?
Programming In C++, Lecture 1
Write A Short Programme.
How you drink water?
Programming In C++, Lecture 1
Computer Programming
A programming language is a communicate instructions to a computer.
Programming languages can be used to create programs that control the
behaviour of a machine and/or to express algorithms precisely.
Programming languages fall into two categories:
Low Level Programming
High Level Programming
Programming In C++, Lecture 1
Computer Programming
Low Level Programming
Low-level languages are considered to be
closer to computers. Its prime function is to
operate, manage and manipulate the
computing hardware and components.
Low Level Languages are:
1. Machine Languages
2. Assembly Languages
Programming In C++, Lecture 1
Computer Programming
High Level Programming
Higher-level languages allow the programmer to
work in a more English-like environment that
resembles natural language or mathematical
notation also visual environment, using graphical
tools.
• Procedural Programming
• Object Oriented Programming
Programming In C++, Lecture 1
Computer Programming
High Level Programming
• Procedural Languages
A computer programming language that executes a set of commands in
order is called procedural Language. It is written as a list of instructions,
telling the computer, step-by-step, what to do.
For Example.
1. Open a file
2. Read a number
3. Multiply by 4
4. Display something.
Procedural programming is fine for small projects. It is the most natural
way to tell a computer what to do.
Programming In C++, Lecture 1
Computer Programming
High Level Programming
• Object Oriented Programming
Programming In C++, Lecture 1
Computer Programming
High Level Programming
• Web Development (HTML, PHP, JSP, ASP etc.)
• Application Development (Java, C, C++, .net etc.)
• Mobile Application (Objective C, J2ME etc.)
• Data Base (SQL, SQL Plus)
Programming In C++, Lecture 1
Computer Programming
Quiz
• What is your Lecturer’s Name & his qualification?
• Which Language is close to computer hardware?
• What is Database language?
• Which level of programming language is close to
human?
• Which programming language will you cover in this
course?
Programming In C++, Lecture 1
What Is C Programming Language?
Programming In C++, Lecture 1
Introduction To C Programming Language
Book
“Turbo C Programming for PC and Turbo C++”
By Robert Lafore,
Programming In C++, Lecture 1
Marks Distribution
Quizzes
10
 Assignments:
10
 Participation & Attendance
5
 Mid-Term
25
 Total Sessional
50
 Terminal Exam
50
------------------------------------------------------------------------- Final Evaluation
100

Programming In C++, Lecture 1
Introduction To C Programming Language



The C programming language was designed by
Dennis Ritchie at Bell Laboratories in the early 1970s
Traditionally used for systems programming, though
this may be changing in favor of C++
C Language in between the Low Level Language and
High Level Language (Middle Level Language)
Programming In C++, Lecture 1
C Mainly Used For

Mainly because it produces code that runs nearly as fast as
code written in assembly language. Some examples of the
use of C might be:
–
–
–
–
–
–
–
–
–
–
Operating Systems
Language Compilers
Assemblers
Text Editors
Print Spoolers
Network Drivers
Modern Programs
Data Bases
Language Interpreters
Utilities
Programming In C++, Lecture 1
What We Need



PC Hardware
Ms-Dos
Turbo C Development System (Integrated Development
System (IDE))
Programming In C++, Lecture 1
Turbo C Development System
• It is a screen display with windows and pull down menus. The program
listing, its output, error messages and other information are displayed in
separate windows.
• You can use menu selections to invoke all the operations necessary to
develop your program including editing, compiling, debugging, Linking
and program execution.
Programming In C++, Lecture 1
Basics of C Environment


C systems consist of 3 parts
– Environment
– Language
– C Standard Library
Development environment has 6 phases
– Editing: Writing the source code by using some IDE or editor
– Pre-processor: Already available routines
– Compile: translates or converts source to object code for a specific platform
– Link: resolves external references and produces the executable module
– Load: load into memory
– Execute : Run the program
Programming In C++, Lecture 1
Basics of C Environment
Compiling
Program are in two versions
1. You type which is called the source file.
2. Machine-Language version, which is called executable file
The Complier, which is a part of the IDE, translates this source
code into another file, consisting of machine language at once.
The Interpreter, which is a part of the IDE, translates this source
code into another file, consisting of machine language but line by
line.
Programming In C++, Lecture 1
Basics of C Environment
Linking
Execute new compiler-generated file to run your program.
The Linker combines all the required files into a single executable
file.
Programming In C++, Lecture 1
Basics of C Environment
Errors
• Syntax Error
• Logical Error
Programming In C++, Lecture 1
Files Used in C Program Development
•
•
•
•
Executable Files
Library & Runtime Files
Header Files
Programmer-Generated Files
Programming In C++, Lecture 1
Files Used in C Program Development
Executable Files
• Executable files are stored in the subdirectory BIN. The most important executable
file for the Turbo C Language is the TC.EXE.
• Executable this program places the IDE on your screen.
• The BIN directory also contains programs for the command line development
process. For example.
•
•
•
•
•
•
TCC
TLINK
TCINST
CPP
TLIB
MAKE
Programming In C++, Lecture 1
Command-line compiler
Command-line linker
Customize Turbo IDE
Pre-processor Utility
Library file manager
File management program
Files Used in C Program Development
Library & Runtime Files
• Various files are combined with your
programs during linking. These files contain
routines for a wide variety of purposes.
• They are stored in LIB subdirectory.
Programming In C++, Lecture 1
Files Used in C Program Development
Library Files
• Library files are group of precompiled routines
for performing specific tasks.
• A library files has a unique characteristic: only
those parts of it that are necessary will be
linked to a program, not the whole file.
Programming In C++, Lecture 1
Files Used in C Program Development
Header Files
• The subdirectory called INCLUDE contains header
files.
• These files are text files, like the one you generate
with a word processor or the Turbo C editor. Header
files can be combined with your program before it is
complied, in the same way that a programmer can
insert a standard heading in a business letter.
• Each header file has a “.h” file extension
Programming In C++, Lecture 1
Files Used in C Program Development
Programmer-Generated Files
• You can place the programs that you write in any
subdirectory you choose: for instance a subdirectory
under TC.
Programming In C++, Lecture 1
Introduction To C Programming Language
Quiz
•
•
•
•
•
•
•
What we need to develop C programme?
What is difference between Complier & interpreter?
What is Linker?
What is source file & Executable file?
How many type or error could have?
What is Header files?
What is Library files?
Programming In C++, Lecture 1