KEMBAR78
Introduction To Programing | PDF | Computer Program | Programming
0% found this document useful (0 votes)
5 views14 pages

Introduction To Programing

Uploaded by

qaddosskhan920
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views14 pages

Introduction To Programing

Uploaded by

qaddosskhan920
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Introduction to Programing

Introduction to Programing
• IDE is a platform where we write a computer program.
• Integrated Development Environment.
• Most of the IDE’s are free available on the internet and
are pretty easy to Install.
• C++ is a case sensitive language.
• We will be using Dev C++ to write the programs in C++.
• There will be two screens of this IDE.
1. Editor (used to write the code)
2. Console (used to see the output)
Structure of the Program
• Libraries: contain information about functions, reserve
words etc
– Libraries are available either in the form of files or
namespace.
– These files are normally called header files.
– Header files are always written with .h extension.
• Main Function
– All instruction are written in main function.
– {} curly parenthesis are used to start/end the body of
program.
– Statements are terminated with ;
Preprocessor Directives
• These are some instructions that are already
processed.
• It starts with the # sign.
• Statements that start with the # sign are
already included in our program.
• There are two types of Preprocessor Directives.
– #Include
– #Define
Preprocessor Directives
• #include
– When ever we add a directive in our program we
add it using #include directives.
– Include < > means files are provided by the compiler.
• E.g. #include<iostream> namespace
• #include<studio.h> file
– Include “ “
• It is used when as a programmer (in future) we make our
header files and libraries.
• We will include those files with “ “
Preprocessor Directives
• #define
• Define directives are used to make the macros.
• Macros are labels in the programing language.
• E.g. If as a programmer I make a macro whose
value is 5.
• Like #define size 5
• It means in the program where size is written its
not size its 5.
First C++ Program
Lifecycle of a Program

Source Translat Object


Linker
Code or Code

Executabl
Memory Loader
e

Lec#1: by M. Rohan Lecturer at CUS 8


IT
Program Errors
There are three types of errors in a program.
1. Syntax Errors:
– When the rules/grammar of programing language is not followed.
2. Run Time Errors:
– A run-time error occurs during the execution of a program. These errors
occur when a program tries to perform an illegal operation, such as
dividing by zero. The program compiles without errors, but when it runs, it
encounters an error that causes it to terminate abnormally.
– Run-time errors are often difficult to detect because they do not show up
until the program is executed E.g. if we give instruction to open a file and
the file does not exist.
3. Logical Errors:
– A logical error is a 'bug' or mistake in a program's source code that results
in incorrect or unexpected behavior.
Program Errors
• Logical Error Example:
Program Errors
4. Linker Error
– A linker error occurs when a program references a
function or variable that is not defined in the
program or the libraries it is linked against. Linker
errors typically occur when a program is compiled
and linked. The linker will report an error if it
cannot find the necessary files or libraries to link
the program.
Program Error
• Linker Error Example:
Program Errors
5. Symantec Errors:
– Semantic errors are errors that occur when the
code written by the programmer makes no sense
to the compiler, even though it is syntactically
correct. They are different from syntax errors,
which indicate errors in the structure of the
program, as semantic errors are related to the
meaning and implementation of the program.
Program Errors
• Symantec Errors Example:

You might also like