2. PROGRAM DEVELOPMENT LIFE CYCLE
• The Program Development Life Cycle (PDLC) in C++ follows a structured
approach to develop software applications.
• The Program Development Life Cycle (PDLC) is a process used in software
engineering to manage the development of software programs. The PDLC is
similar to the Software Development Life Cycle (SDLC) but is applied at a
higher level, to manage the development of multiple software programs or
projects.
3. What is PDLC?
• The PDLC is an iterative process that allows for feedback and adjustments to
be made at each phase, to ensure that the final product meets the needs of
the stakeholders and is of high quality.
• Program Development Life Cycle (PDLC) is a systematic way of developing
quality software.
• It provides an organized plan for breaking down the task of program
development into manageable chunks, each of which must be completed
before moving on to the next phase.
4. Phases of PDLC
• Planning: In this phase, the goals and objectives of the program are defined, and a
plan is developed to achieve them. This includes identifying the resources required
and determining the budget and schedule for the program.
• Analysis: In this phase, the requirements for the program are defined and analysed.
This includes identifying the stakeholders, their needs and expectations, and
determining the functional and non-functional requirements for the program.
• Design: In this phase, the program’s architecture and design are developed. This
includes creating a detailed design of the program’s components and interfaces, as
well as determining how the program will be tested and deployed.
5. • Implementation: In this phase, the program is developed and coded. This includes
writing the program’s source code and creating any necessary documentation.
• Testing: In this phase, the program is tested to ensure that it meets the
requirements and is free of defects.
• Deployment: In this phase, the program is deployed and made available to users.
• Maintenance: After the deployment, the program is maintained by fixing any bugs
or errors that are found and updating the program to meet changing requirements.
6. Steps in PDLC
• Defining the Problem
The first step is to define the problem. In major software projects, this is a job
for system analyst, who provides the results of their work to programmers in
the form of a program specification. The program specification defines the
data used in program, the processing that should take place while finding a
solution, the format of the output and the user interface.
7. Designing the Program
Program design starts by focusing on the main goal that the program is trying to
achieve and then breaking the program into manageable components, each of which
contributes to this goal. This approach of program design is called top-bottom
program design or modular programming. The first step involve identifying main
routine, which is the one of program’s major activity. From that point, programmers
try to divide the various components of the main routine into smaller parts called
modules. For each module, programmer draws a conceptual plan using an appropriate
program design tool to visualize how the module will do its assign job.
8. • Structure Charts: A structure chart, also called Hierarchy chart, show top-
down design of program. Each box in the structure chart indicates a task
that program must accomplish. The Top module, called the Main module or
Control module.
9.
10. • Algorithms: An algorithm is a step-by-step description of how to arrive at a
solution in the most easiest way. Algorithms are not restricted to computer
world only. In fact, we use them in everyday life.
11. BUILDING BLOCKS
In C++, building blocks refer to the fundamental components used to create programs. These
building blocks include variables, data types, operators, control structures (such as loops and
conditional statements), functions, classes, and objects. Each of these elements plays a
crucial role in constructing and executing C++ programs.
12. In C++, building blocks refer to the fundamental components or features of the language that allow developers to create complex programs.
Here are some of the key building blocks in C++:
1.Variables and Data Types: Variables are used to store data, and data types define the type of data that can be stored in a
variable.
C++ supports various built-in data types such as integers, floating-point numbers, characters, Booleans, etc.,
and also allows defining user-defined data types through classes and structures.
2.Operators: Operators are symbols used to perform operations on variables and values.
C++ supports various types of operators such as arithmetic operators (+, -, *, /), relational operators (==, !=, <, >), logical
operators (&&, ||, !), etc
.
3.Control Structures: Control structures are used to control the flow of execution in a program. C++ supports three main types
of control structures:
•Selection structures (if, else if, else, switch): These structures are used to execute different blocks of code based on
certain conditions.
•Iteration structures (for, while, do-while): These structures are used to execute a block of code repeatedly as long as a
condition is true.
•Jump statements (break, continue, return, goto): These statements are used to alter the flow of control in a program.
13. EXAMPLE OF EQUALITY SYMBOL
• int a = 5;
• int b = 7;
• if (a == b) {
• // This block will not be executed because a is not equal to b
• cout << "a is equal to b";
• } else {
• cout << "a is not equal to b"; // This will be printed
• }
14. 4.Functions: Functions are self-contained blocks of code that perform a specific task. They allow code
reusability and modular programming. C++ supports both built-in functions (like printf() and scanf()) and user-
defined functions.
5.Arrays and Strings: Arrays are collections of similar data elements stored in contiguous memory locations,
and strings are arrays of characters. C++ provides built-in support for arrays and strings, along with various
functions and operations to manipulate them.
6.Classes and Objects: Classes are user-defined data types that encapsulate data and behavior (functions)
into a single unit. Objects are instances of classes. Classes and objects form the basis of object-oriented
programming (OOP) in C++, providing features such as encapsulation, inheritance, and polymorphism.
7.Pointers and References: Pointers are variables that store memory addresses, allowing direct manipulation
of memory. References are aliases to existing variables. Both pointers and references are powerful features in
C++ for efficient memory management and for working with complex data structures.
16. FUNCTIONS
• Functions are sub-program i.e the part of a program that are intended to
perform a particular task;
• Remember, it is not a complete program.
• Functions are of two types:
Library Function/Built in Functions
User-defined funtions
17. CONT..
A function is a group of statements that together perform a task.
Every c++ program has at least one function, which is main().
void main()
{
Statements;
}
18. Difference
User defined function Library function
These functions are not predefined in the
Compiler.
These functions are predefined in the compiler of
C++ language.
These functions are created by users as per their
own requirements.
These functions are not created by users as their
own.
User-defined functions are not stored in library
files.
Library Functions are stored in a special library file.
Execution of the program begins from the user-
define function.
Execution of the program does not begin from the
library function.
Example: sum(), fact(),…etc. Example: printf(), scanf(), sqrt(),…etc.
19. ARRAY
• An array is a collection of items of same data type stored at contiguous
memory locations.
20. Cont..
• The array has a fixed size meaning once the size is given to it, it cannot be
changed i.e. you can’t shrink it nor can you expand it.
• Indexing of an array starts from 0. It means the first element is stored at the
0th index, the second at 1st, and so on.
• Elements of an array can be accessed using their indices.
• Once an array is declared its size remains constant throughout the program.
• An array can have multiple dimensions.
21. Array Declaration in C++
• In C++, we can declare an array by simply specifying the data type first and
then the name of an array with its size.
• data_type array_name[size of array];
• EXAMPLE:
• Int arr[5];
22. PROGRAM
#include <iostream>
using namespace std;
int main()
{
int arr[3];
// Inserting elements in an array
arr[0] = 10;
arr[1] = 20;
arr[2] = 30;
// Accessing and printing elements of the array
cout << "arr[0]: " << arr[0] << endl;
cout << "arr[1]: " << arr[1] << endl;
cout << "arr[2]: " << arr[2] << endl;
return 0;
}
23. Pointer
• A pointer in C++ is a variable that stores the memory address of another
variable. In simpler terms, a pointer "points to" or "references" a memory
location where some other data is stored. Pointers are powerful features of
the C++ language that allow you to work directly with memory addresses,
enabling dynamic memory allocation, manipulation of data structures, and
efficient passing of parameters to functions.
24. • #include <iostream>
• using namespace std;
• int main() {
• int x = 10; // Declare an integer variable
• int* b; // Declare a pointer to an integer
• b = &x; // Assign the address of x to the pointer ptr
• cout << "Value of x: " << x << endl; // Output: Value of x: 10
• cout << "Address of x: " << &x << endl; // Output: Address of x: <memory address>
• cout << "Value stored in b: " << b << endl; // Output: Value stored in b: <memory address>
• cout << "Value pointed to by b: " << *b << endl; // Output: Value pointed to by ptr: 10
25. IDENTIFIER
• In C++, an identifier is a name used to identify various elements in a
program such as variables, functions, classes, labels, etc. Identifiers are used
to give names to program elements, making it easier for programmers to
refer to them in their code.
26. Naming Rules
•Identifiers can consist of letters (both uppercase and lowercase), digits, and underscore _.
•The first character of an identifier must be a letter or underscore.
•Identifiers are case-sensitive. For example, Variable, variable, and VARIABLE are considered
different identifiers.
•C++ reserves certain identifiers for language keywords (e.g., if, for, int, etc.), so you cannot use them as identifiers for
your own variables or functions.
27. PROGRAM
• #include <iostream>
• using namespace std;
• int main() {
• int numberOfStudents = 50; // Variable declaration with an identifier numberOfStudents
• cout << "Number of students: " << numberOfStudents << endl;
• return 0;
• }
28. KEYWORDS
• In C++, a keyword is a reserved word that has a predefined meaning and
cannot be used as an identifier (such as variable names or function names) in
the program. Keywords are an integral part of the language syntax and are
used to define the structure and behaviour of C++ programs.
• keywords like "int", "if", "else", "for", "while", "class", "public", "private",
etc., have specific meanings and functionalities within the C++ language
29. EXAMPLES
• auto: Specifies automatic type deduction for variables.
• bool: Represents Boolean type with true or false values.
• break: Terminates the current loop or switch statement.
• case: Defines a particular case in a switch statement.
• char: Represents a single character data type.
• class: Declares a class.
• const: Defines a variable as constant.
30. Cont..
• default: Defines the default case in a switch statement.
• delete: Deallocates memory allocated by new.
• friend: Grants access to private and protected members of a class to another
function or class.
• goto: Transfers control to a labeled statement.