




















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A comprehensive introduction to the program development process, exploring different types of programming languages, including low-level and high-level languages. It delves into the structure of c++ programs, covering preprocessor directives, the main() function, and c++ statements. The document also explains essential concepts like data types, tokens, and the use of the 'cout' object for output. It concludes with practical exercises to reinforce understanding.
Typology: Lecture notes
1 / 28
This page cannot be seen from the preview
Don't miss anything!





















Program Development Process
Programing Languages
Types of Codes
There are two types of codes that are as follows:
Source Code :
A program written in a high-level language is called source code. Source code is
also called source program.
Computer cannot understand the statements of high-level language.
The source code cannot be executed by computer directly.
It is converted into object code and then executed.
Object Code :
A program in machine language is called object code.
It is also called object program or machine code. Computer understands object
code directly.
Language Processor
Compiler
Source Program Object Program
Language Processor
An interpreter is a program that converts one statement of a program at one time.
It executes this statement before translating the next statement of the source
program.
If there is an error in the statements, the interpreter stops working and displays an
errors message.
The advantage of interpreters over compilers is that an error is found
immediately.
Relationship of Object Program, Source Program and Compiler
Basic Structure of C ++ Program
The format of writing program in C++ is called its structure.
▪The basic structure of C++ program is very flexible.
▪It increases the power of language.
▪It consists of the following parts:
Preprocessor directive
Main() function
Program body (C++ statements)
Basic Structure of C ++ Program
The following preprocessor directive is used in C++ to include header files in the
program:
Include Preprocessor
Include preprocessor directive is used to include header files in the program.
The syntax of using this directive is as
follows: #include <iostream.h>
▪The above statement tells the compiler to include the file iostream.h in source
program before compiling it.
Basic Structure of C ++ Program
Header Files
▪Header files are collection of standard library functions to perform different tasks.
▪ There are many header files for different purposes.
▪Each header files contains different types of predefined functions.
▪ Many header files can be included in one program.
▪The header file must be included in the program before calling any of its functions in the
program.
▪ The extension of a header file is .h.
▪The include preprocessor directive is used to include header files in programs.
▪ These files are provided by C++ compiler system.
▪The header files are normally stored in INCLUDE subdirectory.
▪ The name of header file is written in angle brackets.
Basic Structure of C ++ Program
Basic Structure of C ++ Program
Basic Structure of C ++ Program
#include
using namespace std;
int main()
{
cout<< "Welcome to UET";
}
Program body
(C++ statements)
In the above example,
The first line is preprocessor directive to include a header file iostream.
The using namespace std; line tells the compiler to expect stuff from the C++ Standard Library to be used in this file.
Without this line, each keyword from the library would have to be preceded with a std:: , to denote its scope. For
instance, without that line, each reference to cout would have to be written as std::cout. The using statement is added to
make the code look more clean.
The third line is main function where the execution of program starts.
Statement terminator
Preprocessor directive
Main function
Basic Structure of C ++ Program
cout << Message