0% found this document useful (0 votes)
2 views19 pages

SPM_Module1.pptx

Module 1 introduces Structured Programming Methodology, covering problem-solving, algorithms, flowcharts, and program execution. It emphasizes the importance of structured programming with its core constructs: sequence, selection, and iteration, alongside the software development lifecycle. The module also discusses organizing code through header files, packages, and namespaces, and outlines data types, operators, and type conversions.

Uploaded by

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

SPM_Module1.pptx

Module 1 introduces Structured Programming Methodology, covering problem-solving, algorithms, flowcharts, and program execution. It emphasizes the importance of structured programming with its core constructs: sequence, selection, and iteration, alongside the software development lifecycle. The module also discusses organizing code through header files, packages, and namespaces, and outlines data types, operators, and type conversions.

Uploaded by

lakshspotify97
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

MODULE 1

Introduction to Structured Programming Methodology

Structured Programming Methodology | 316U06C107


F.Y. [Link] (Common to All) | Academic Year 2026-27

1
Module Overview
5 Hours | Course Outcome: CO1

1 1.1 Problem Solving & Algorithms


Problem definition, algorithms, flowcharts, program design, pseudocode

1.2 Structured Programming CO1: Formulate a problem statement and


2
develop the logic (algorithm / flowchart)
Core paradigm and its building blocks
for its solution.

3 1.3 Program Execution & SDLC


How code becomes a running program; software development lifecycle

Bloom's Level: Apply


4 1.4 Header Files, Packages & Namespaces
Organizing and reusing code

5 1.5 Data & Operators


Data types, identifiers, constants, variables, operators, expressions, type conversion

2
Problem Definition & Problem-Solving Skills
Topic 1.1

A well-defined problem statement is the starting point of every program — it precisely states what is to be solved, the given inputs, and the
expected output.

1 2 3 4 5
Understand Analyze Plan Solve Verify
Read and restate the problem Identify inputs, outputs, and Design an algorithm / flowchart Translate the plan into a Test with sample data and
in your own words constraints for the solution program refine

Why it matters: skipping this step is the single biggest cause of programs that compile but solve the wrong problem.

3
Algorithms: Definition & Characteristics
Topic 1.1

An algorithm is a finite, well-defined sequence of steps that transforms given inputs into the desired output.

Characteristics of a Good Algorithm Example: Largest of Two Numbers

• Finiteness
Step 1: Start
Must terminate after a finite number of steps
Step 2: Read two numbers A and B
• Definiteness Step 3: If A > B then go to Step 4, else go to
Each step must be precise and unambiguous Step 5
Step 4: Print A as largest; go to Step 6
• Input
Step 5: Print B as largest
Zero or more well-specified inputs
Step 6: Stop

• Output
At least one well-specified output

• Effectiveness
Each step must be basic enough to be carried out

4
Flowcharts: Standard Symbols
Topic 1.1

A flowchart is the diagrammatic representation of an algorithm, using standard symbols to show the flow of control.

Terminal Input / Output Process

Start / End of the flowchart Data input or output operation A processing / computation step

Connector
Decision Flow Line
Links parts of a flowchart (small circle)
A yes/no or true/false branching point Direction of program flow

5
Flowchart Example: Largest of Two Numbers
Topic 1.1

Start
The decision box is the only symbol with two
outgoing flow lines — one per branch (Yes / No).
Read A, B

Yes No Every flowchart begins and ends with a single


Print A is largest A>B? Print B is largest Terminal (oval) symbol.

Stop

6
Program Design & Pseudocode
Topic 1.1

Program Design Approaches What is Pseudocode?

Top-Down Design An English-like, informal notation for describing an algorithm's logic —


1 without worrying about a specific programming language's syntax.
Break the problem into smaller sub-problems, then refine each

2 Modular Design BEGIN


Organize code into independent, reusable modules / functions READ A, B
IF A > B THEN
PRINT "A is largest"
3 Stepwise Refinement ELSE
Successively add detail to each module until it is code-ready PRINT "B is largest"
END IF
END

Convention: pseudocode uses keywords like BEGIN, READ, IF...THEN...ELSE, and END — but no fixed grammar. Clarity matters more than syntax.

7
Structured Programming
Topic 1.2

Structured Programming is a paradigm that builds programs using only three well-defined control constructs — improving readability and
eliminating unpredictable "jumps" (goto) in program flow.

Sequence Selection Iteration


Statements execute one after another, in A condition chooses between alternative A block of statements repeats while a
the order written paths (if-else, switch) condition holds (loops)

Benefits: easier to read & follow • simpler to debug & test • supports modular reuse • reduces logical errors

8
Program Execution Process
Topic 1.3

Source Object Linker Executable Execution


Compiler
Code Code (+ Libraries) File (Output)

1 Compilation
The compiler translates source code into object code, flagging syntax errors

2 Linking
The linker combines object code with library routines into a single executable

3 Loading & Execution


The loader places the executable in memory; the CPU executes it, producing output

9
Systems Development Life Cycle (SDLC)
Topic 1.3

SDLC is the structured sequence of phases followed to plan, build, and maintain quality software.

Requirement
Analysis

Maintenance Design

A cyclic process: maintenance feedback


often triggers a new round of requirement
analysis for future enhancements.
SDLC

Implementation
Deployment
(Coding)

Testing

10
Header Files, Packages & Namespaces
Topic 1.4

Header Files Packages Namespaces

Contain function prototypes, macros, and A way of grouping related classes, functions, A named scope that prevents naming
declarations shared across files (e.g., stdio.h, or modules together for organization, reuse, conflicts between identifiers (e.g., two
math.h). Included using #include so the and controlled access across a project. libraries defining the same function name).
compiler knows the interface before use.

Why they matter: header files, packages, and namespaces together let large programs be split across files/modules without naming collisions or
duplicated declarations — the foundation of scalable, reusable code.

11
Data Types
Topic 1.5 — Data & Operators

Data Types

Primary (Basic) Derived User-Defined


int, float, char, double, array, pointer, function structure, union,
void enumeration

Note: In C, int stores whole numbers, float / double store real (decimal) numbers, and char stores a single character.

Derived types are built from primary types (e.g., an array of int); user-defined types let the programmer create custom composite types.

12
Identifiers, Constants & Variables
Topic 1.5 — Data & Operators

1 Identifier
A name given to a variable, function, or other entity. Must start with a letter or underscore, contain only letters/digits/underscore, and avoid reserved keywords.

2 Variable
A named storage location whose value can change during program execution. Declared with a data type, e.g., int marks;

3 Constant
A named storage location whose value cannot change once set — a literal constant (e.g., 3.14) or a defined constant (#define PI 3.14 / const float PI = 3.14;)

int marks = 95; // variable


const float PI = 3.14f; // constant

13
Types of Operators
Topic 1.5 — Data & Operators

Category Symbols Example

Arithmetic + - * / % a + b, a % b

Relational == != > < >= <= a>b

Logical && || ! (a > 0) && (b > 0)

Assignment = += -= *= /= a += 5

Increment / Decrement ++ -- a++, --b

Bitwise & | ^ ~ << >> a&b

Conditional (Ternary) ? : (a > b) ? a : b

14
Expressions & Evaluation of Expressions
Topic 1.5 — Data & Operators

An expression is a combination of operands (variables, constants) and operators that evaluates to a single value.

1 Arithmetic Expression
Evaluates to a numeric value, e.g., c = a + b * 2;

2 Relational Expression
Evaluates to true / false, e.g., a > b

3 Logical Expression
Combines relational expressions, e.g., (a > 0) && (b > 0)

Evaluation walk-through:
c = a + b * 2; → with a = 3, b = 4: b * 2 = 8 (evaluated first — * before +) → c = 3 + 8 = 11

15
Operator Precedence & Associativity
Topic 1.5 — Data & Operators

Precedence Operators Associativity

Highest () [] Left to Right

++ -- (unary) ! Right to Left

* / % Left to Right

+ - Left to Right

< <= > >= Left to Right

== != Left to Right

&& Left to Right

|| Left to Right

Lowest = += -= *= /= Right to Left

Example: 2 + 3 * 4 → * has higher precedence than +, so 3 * 4 = 12 is evaluated first → 2 + 12 = 14


16
Type Conversions
Topic 1.5 — Data & Operators

Implicit Conversion Explicit Conversion


(Automatic / Type Promotion) (Type Casting)

The compiler automatically converts one data type to another to avoid The programmer manually forces a conversion using the cast operator,
data loss during an expression — typically from a lower to a higher when automatic promotion isn't what's needed.
type.

int a = 5; float x = 9.7;


float b = a; // 5 becomes 5.0 int y = (int) x; // y = 9

Conversion hierarchy (low → high): char → int → long → float → double

17
Module 1: Summary

1 1.1 Problem Solving, Algorithms & Flowcharts


Define the problem, plan the logic, visualize it as a flowchart

2 1.2 Structured Programming


Sequence, Selection, Iteration — the three building blocks

3 1.3 Program Execution & SDLC


Compile → Link → Execute; and the software lifecycle phases

4 1.4 Header Files, Packages & Namespaces


Organizing and reusing code across a project

5 1.5 Data & Operators


Data types, identifiers, constants, variables, operators, expressions, precedence, type conversion

Outcome achieved (CO1): You can now formulate a problem statement and develop an algorithm / flowchart for its solution.

18
References — Module 1

● Kenneth Leroy Busbee, “Programming Fundamentals – A Modular Structured Approach using C++”, Rice University, Houston, Texas, 2013
● Hassan Afyouni, Behrouz A. Forouzan, “Computer Science: A Structured Programming Approach Using C”, Cengage India, 4th Ed., 2023
● Behrouz A. Forouzan, Richard F. Gilberg, “Computer Science: A Structured Approach Using C++”, Cengage India, 2nd Ed., 2012
● E. Balagurusamy, “Programming in ANSI C”, McGraw-Hill Education, India, 8th Ed., 2019
● Pradeep Dey, Manas Ghosh, “Structured Programming Approach”, Oxford University Press, India, 1st Ed., 2016

Online Resources (NPTEL)

● NPTEL — Programming in C: [Link]/noc22_cs40/preview


● NPTEL — Programming in C++: [Link]/noc21_cs02/preview

As per SVU-KJSSE Syllabus R-2025_3.0


19

You might also like