際際滷

際際滷Share a Scribd company logo
Programming
Fundamentals
By
Adnan Waheed
University of Narowal
Functions
Lecture No. 20
Wednesday, November 22, 2023
In this week/classes, you will:
 Learn about standard (predefined) functions
and discover how to use them in a program
 Learn about user-defined functions
 Examine value-returning functions, including
actual and formal parameters
 Explore how to construct and use a value-
returning, user-defined function in a program
Objectives
Modular Programming
 Modular programming: breaking a program up into
smaller, manageable functions or modules
 Function: a collection of statements to perform a task
 Motivation for modular programming
 Improves maintainability of programs
 Simplifies the process of writing programs
Introduction
 Boss to worker analogy
 A boss (the calling function or caller) asks a worker (the
called function) to perform a task and return (i.e., report
back) the results when the task is done.
Introduction
 Functions are like building blocks
 They allow complicated programs to be
divided into manageable pieces
 Some advantages of functions:
 A programmer can focus on just that part of the
program and construct it, debug it, and perfect it
 Different people can work on different
functions simultaneously
 Can be re-used (even in different programs)
 Enhance program readability
Introduction (cont'd.)
 Functions
 Called modules
 Like miniature programs
 Can be put together to form a larger program

More Related Content

Similar to functions in C++.pdf (20)

PCCF UNIT 2 CLASS.pptx
PCCF UNIT 2 CLASS.pptxPCCF UNIT 2 CLASS.pptx
PCCF UNIT 2 CLASS.pptx
vishnupriyapm4
Discussion Post 1A software process model is a streamlined port.docx
Discussion Post 1A software process model is a streamlined port.docxDiscussion Post 1A software process model is a streamlined port.docx
Discussion Post 1A software process model is a streamlined port.docx
madlynplamondon
Software design
Software designSoftware design
Software design
Himanshu Awasthi
Object Oriented Analysis
Object Oriented AnalysisObject Oriented Analysis
Object Oriented Analysis
AMITJain879
Mit3033 software architecture
Mit3033  software architectureMit3033  software architecture
Mit3033 software architecture
smumbahelp
Algorithm and Data Structure - Modular Programming
Algorithm and Data Structure - Modular ProgrammingAlgorithm and Data Structure - Modular Programming
Algorithm and Data Structure - Modular Programming
AndiNurkholis1
Structured programming & Programming methodologies.pptx
Structured programming & Programming methodologies.pptxStructured programming & Programming methodologies.pptx
Structured programming & Programming methodologies.pptx
Ritu Sachdeva
Chapter-3 Scoping.pptx
Chapter-3 Scoping.pptxChapter-3 Scoping.pptx
Chapter-3 Scoping.pptx
JebasudhaKingston1
Se chapter 1,2,3 2 mark qa
Se chapter 1,2,3   2 mark  qaSe chapter 1,2,3   2 mark  qa
Se chapter 1,2,3 2 mark qa
Aruna M
1. oop with c++ get 410 day 1
1. oop with c++ get 410   day 11. oop with c++ get 410   day 1
1. oop with c++ get 410 day 1
Mukul kumar Neal
Lecture No.1.pptx
Lecture No.1.pptxLecture No.1.pptx
Lecture No.1.pptx
anzazubair91
3.o o design -_____________lecture 3
3.o o design -_____________lecture 33.o o design -_____________lecture 3
3.o o design -_____________lecture 3
Warui Maina
Project Management
Project ManagementProject Management
Project Management
Babu Appat
Unified process model
Unified process modelUnified process model
Unified process model
RyndaMaala
Unit IV Software Engineering
Unit IV Software EngineeringUnit IV Software Engineering
Unit IV Software Engineering
Nandhini S
PCCF UNIT 2.pptx
PCCF UNIT 2.pptxPCCF UNIT 2.pptx
PCCF UNIT 2.pptx
DivyaKS12
Chapter_8_Designing_Efficient_Programs.pptx
Chapter_8_Designing_Efficient_Programs.pptxChapter_8_Designing_Efficient_Programs.pptx
Chapter_8_Designing_Efficient_Programs.pptx
DarshanR953832
Software Engineering Unit 3 Key Concepts and Practices
Software Engineering Unit 3 Key Concepts and PracticesSoftware Engineering Unit 3 Key Concepts and Practices
Software Engineering Unit 3 Key Concepts and Practices
chessclubniet
OOP - Benefits and advantages of OOP
OOP - Benefits and advantages of OOPOOP - Benefits and advantages of OOP
OOP - Benefits and advantages of OOP
Mudasir Qazi
Unit 3
Unit 3Unit 3
Unit 3
Jignesh Kariya
PCCF UNIT 2 CLASS.pptx
PCCF UNIT 2 CLASS.pptxPCCF UNIT 2 CLASS.pptx
PCCF UNIT 2 CLASS.pptx
vishnupriyapm4
Discussion Post 1A software process model is a streamlined port.docx
Discussion Post 1A software process model is a streamlined port.docxDiscussion Post 1A software process model is a streamlined port.docx
Discussion Post 1A software process model is a streamlined port.docx
madlynplamondon
Object Oriented Analysis
Object Oriented AnalysisObject Oriented Analysis
Object Oriented Analysis
AMITJain879
Mit3033 software architecture
Mit3033  software architectureMit3033  software architecture
Mit3033 software architecture
smumbahelp
Algorithm and Data Structure - Modular Programming
Algorithm and Data Structure - Modular ProgrammingAlgorithm and Data Structure - Modular Programming
Algorithm and Data Structure - Modular Programming
AndiNurkholis1
Structured programming & Programming methodologies.pptx
Structured programming & Programming methodologies.pptxStructured programming & Programming methodologies.pptx
Structured programming & Programming methodologies.pptx
Ritu Sachdeva
Se chapter 1,2,3 2 mark qa
Se chapter 1,2,3   2 mark  qaSe chapter 1,2,3   2 mark  qa
Se chapter 1,2,3 2 mark qa
Aruna M
1. oop with c++ get 410 day 1
1. oop with c++ get 410   day 11. oop with c++ get 410   day 1
1. oop with c++ get 410 day 1
Mukul kumar Neal
Lecture No.1.pptx
Lecture No.1.pptxLecture No.1.pptx
Lecture No.1.pptx
anzazubair91
3.o o design -_____________lecture 3
3.o o design -_____________lecture 33.o o design -_____________lecture 3
3.o o design -_____________lecture 3
Warui Maina
Project Management
Project ManagementProject Management
Project Management
Babu Appat
Unified process model
Unified process modelUnified process model
Unified process model
RyndaMaala
Unit IV Software Engineering
Unit IV Software EngineeringUnit IV Software Engineering
Unit IV Software Engineering
Nandhini S
PCCF UNIT 2.pptx
PCCF UNIT 2.pptxPCCF UNIT 2.pptx
PCCF UNIT 2.pptx
DivyaKS12
Chapter_8_Designing_Efficient_Programs.pptx
Chapter_8_Designing_Efficient_Programs.pptxChapter_8_Designing_Efficient_Programs.pptx
Chapter_8_Designing_Efficient_Programs.pptx
DarshanR953832
Software Engineering Unit 3 Key Concepts and Practices
Software Engineering Unit 3 Key Concepts and PracticesSoftware Engineering Unit 3 Key Concepts and Practices
Software Engineering Unit 3 Key Concepts and Practices
chessclubniet
OOP - Benefits and advantages of OOP
OOP - Benefits and advantages of OOPOOP - Benefits and advantages of OOP
OOP - Benefits and advantages of OOP
Mudasir Qazi

Recently uploaded (20)

Data Storytelling for Portfolio Leaders - Webinar
Data Storytelling for Portfolio Leaders - WebinarData Storytelling for Portfolio Leaders - Webinar
Data Storytelling for Portfolio Leaders - Webinar
OnePlan Solutions
AnyDesk Pro 3.7.0 Crack License Key Free Download 2025 [Latest]
AnyDesk Pro 3.7.0 Crack License Key Free Download 2025 [Latest]AnyDesk Pro 3.7.0 Crack License Key Free Download 2025 [Latest]
AnyDesk Pro 3.7.0 Crack License Key Free Download 2025 [Latest]
haroonsaeed605
Next-Gen Procurement: Leveraging AI for Smarter Sourcing & Cost Optimization
Next-Gen Procurement: Leveraging AI for Smarter Sourcing & Cost OptimizationNext-Gen Procurement: Leveraging AI for Smarter Sourcing & Cost Optimization
Next-Gen Procurement: Leveraging AI for Smarter Sourcing & Cost Optimization
asmith539880
Tenorshare 4uKey Crack Fre e Download
Tenorshare  4uKey  Crack  Fre e DownloadTenorshare  4uKey  Crack  Fre e Download
Tenorshare 4uKey Crack Fre e Download
oyv9tzurtx
AI-Powered Chatbots for Employee Support
AI-Powered Chatbots for Employee SupportAI-Powered Chatbots for Employee Support
AI-Powered Chatbots for Employee Support
AutomationEdge Technologies
Build the future with Agentforce and Mulesoft
Build the future with Agentforce and  MulesoftBuild the future with Agentforce and  Mulesoft
Build the future with Agentforce and Mulesoft
GiulioPicchi
Minitool Partition Wizard Crack Free Download
Minitool Partition Wizard Crack Free DownloadMinitool Partition Wizard Crack Free Download
Minitool Partition Wizard Crack Free Download
v3r2eptd2q
Elastic Search Engineer Certification - Virtual
Elastic Search Engineer Certification - VirtualElastic Search Engineer Certification - Virtual
Elastic Search Engineer Certification - Virtual
Gon巽alo Pereira
Adobe InDesign Crack Full Version Free Download 2025
Adobe InDesign Crack  Full Version Free Download 2025Adobe InDesign Crack  Full Version Free Download 2025
Adobe InDesign Crack Full Version Free Download 2025
sannnasaba545
SE- Lecture 5 for software development.ppt
SE- Lecture 5 for software development.pptSE- Lecture 5 for software development.ppt
SE- Lecture 5 for software development.ppt
theworldimagine985
How John started to like TDD (instead of hating it) - TED talk
How John started to like TDD (instead of hating it) - TED talkHow John started to like TDD (instead of hating it) - TED talk
How John started to like TDD (instead of hating it) - TED talk
Nacho Cougil
SketchUp Pro Crack [2025]-Free Download?
SketchUp Pro Crack [2025]-Free Download?SketchUp Pro Crack [2025]-Free Download?
SketchUp Pro Crack [2025]-Free Download?
kiran10101khan
Drawing Heighways Dragon - Recursive Function Rewrite - From Imperative Styl...
Drawing Heighways Dragon - Recursive Function Rewrite - From Imperative Styl...Drawing Heighways Dragon - Recursive Function Rewrite - From Imperative Styl...
Drawing Heighways Dragon - Recursive Function Rewrite - From Imperative Styl...
Philip Schwarz
Consequences and Principles of Software Quality v1.0
Consequences and Principles of Software Quality v1.0Consequences and Principles of Software Quality v1.0
Consequences and Principles of Software Quality v1.0
Yann-Ga谷l Gu辿h辿neuc
Wondershare Filmora Crack Free Download
Wondershare Filmora  Crack Free DownloadWondershare Filmora  Crack Free Download
Wondershare Filmora Crack Free Download
zqeevcqb3t
Lecture-11-AutomatedTesting-software.pptx
Lecture-11-AutomatedTesting-software.pptxLecture-11-AutomatedTesting-software.pptx
Lecture-11-AutomatedTesting-software.pptx
ssuser39f59e
Code or No-Code Tests: Why Top Teams Choose Both
Code or No-Code Tests: Why Top Teams Choose BothCode or No-Code Tests: Why Top Teams Choose Both
Code or No-Code Tests: Why Top Teams Choose Both
Applitools
Mastering Software Test Automation: A Comprehensive Guide for Beginners and E...
Mastering Software Test Automation: A Comprehensive Guide for Beginners and E...Mastering Software Test Automation: A Comprehensive Guide for Beginners and E...
Mastering Software Test Automation: A Comprehensive Guide for Beginners and E...
Shubham Joshi
salesforce development services - Alt digital
salesforce development services - Alt digitalsalesforce development services - Alt digital
salesforce development services - Alt digital
Alt Digital Technologies
Computer Architecture Patterson chapter 1 .ppt
Computer Architecture Patterson chapter 1 .pptComputer Architecture Patterson chapter 1 .ppt
Computer Architecture Patterson chapter 1 .ppt
jaysen110
Data Storytelling for Portfolio Leaders - Webinar
Data Storytelling for Portfolio Leaders - WebinarData Storytelling for Portfolio Leaders - Webinar
Data Storytelling for Portfolio Leaders - Webinar
OnePlan Solutions
AnyDesk Pro 3.7.0 Crack License Key Free Download 2025 [Latest]
AnyDesk Pro 3.7.0 Crack License Key Free Download 2025 [Latest]AnyDesk Pro 3.7.0 Crack License Key Free Download 2025 [Latest]
AnyDesk Pro 3.7.0 Crack License Key Free Download 2025 [Latest]
haroonsaeed605
Next-Gen Procurement: Leveraging AI for Smarter Sourcing & Cost Optimization
Next-Gen Procurement: Leveraging AI for Smarter Sourcing & Cost OptimizationNext-Gen Procurement: Leveraging AI for Smarter Sourcing & Cost Optimization
Next-Gen Procurement: Leveraging AI for Smarter Sourcing & Cost Optimization
asmith539880
Tenorshare 4uKey Crack Fre e Download
Tenorshare  4uKey  Crack  Fre e DownloadTenorshare  4uKey  Crack  Fre e Download
Tenorshare 4uKey Crack Fre e Download
oyv9tzurtx
Build the future with Agentforce and Mulesoft
Build the future with Agentforce and  MulesoftBuild the future with Agentforce and  Mulesoft
Build the future with Agentforce and Mulesoft
GiulioPicchi
Minitool Partition Wizard Crack Free Download
Minitool Partition Wizard Crack Free DownloadMinitool Partition Wizard Crack Free Download
Minitool Partition Wizard Crack Free Download
v3r2eptd2q
Elastic Search Engineer Certification - Virtual
Elastic Search Engineer Certification - VirtualElastic Search Engineer Certification - Virtual
Elastic Search Engineer Certification - Virtual
Gon巽alo Pereira
Adobe InDesign Crack Full Version Free Download 2025
Adobe InDesign Crack  Full Version Free Download 2025Adobe InDesign Crack  Full Version Free Download 2025
Adobe InDesign Crack Full Version Free Download 2025
sannnasaba545
SE- Lecture 5 for software development.ppt
SE- Lecture 5 for software development.pptSE- Lecture 5 for software development.ppt
SE- Lecture 5 for software development.ppt
theworldimagine985
How John started to like TDD (instead of hating it) - TED talk
How John started to like TDD (instead of hating it) - TED talkHow John started to like TDD (instead of hating it) - TED talk
How John started to like TDD (instead of hating it) - TED talk
Nacho Cougil
SketchUp Pro Crack [2025]-Free Download?
SketchUp Pro Crack [2025]-Free Download?SketchUp Pro Crack [2025]-Free Download?
SketchUp Pro Crack [2025]-Free Download?
kiran10101khan
Drawing Heighways Dragon - Recursive Function Rewrite - From Imperative Styl...
Drawing Heighways Dragon - Recursive Function Rewrite - From Imperative Styl...Drawing Heighways Dragon - Recursive Function Rewrite - From Imperative Styl...
Drawing Heighways Dragon - Recursive Function Rewrite - From Imperative Styl...
Philip Schwarz
Consequences and Principles of Software Quality v1.0
Consequences and Principles of Software Quality v1.0Consequences and Principles of Software Quality v1.0
Consequences and Principles of Software Quality v1.0
Yann-Ga谷l Gu辿h辿neuc
Wondershare Filmora Crack Free Download
Wondershare Filmora  Crack Free DownloadWondershare Filmora  Crack Free Download
Wondershare Filmora Crack Free Download
zqeevcqb3t
Lecture-11-AutomatedTesting-software.pptx
Lecture-11-AutomatedTesting-software.pptxLecture-11-AutomatedTesting-software.pptx
Lecture-11-AutomatedTesting-software.pptx
ssuser39f59e
Code or No-Code Tests: Why Top Teams Choose Both
Code or No-Code Tests: Why Top Teams Choose BothCode or No-Code Tests: Why Top Teams Choose Both
Code or No-Code Tests: Why Top Teams Choose Both
Applitools
Mastering Software Test Automation: A Comprehensive Guide for Beginners and E...
Mastering Software Test Automation: A Comprehensive Guide for Beginners and E...Mastering Software Test Automation: A Comprehensive Guide for Beginners and E...
Mastering Software Test Automation: A Comprehensive Guide for Beginners and E...
Shubham Joshi
salesforce development services - Alt digital
salesforce development services - Alt digitalsalesforce development services - Alt digital
salesforce development services - Alt digital
Alt Digital Technologies
Computer Architecture Patterson chapter 1 .ppt
Computer Architecture Patterson chapter 1 .pptComputer Architecture Patterson chapter 1 .ppt
Computer Architecture Patterson chapter 1 .ppt
jaysen110

functions in C++.pdf

  • 1. Programming Fundamentals By Adnan Waheed University of Narowal Functions Lecture No. 20 Wednesday, November 22, 2023
  • 2. In this week/classes, you will: Learn about standard (predefined) functions and discover how to use them in a program Learn about user-defined functions Examine value-returning functions, including actual and formal parameters Explore how to construct and use a value- returning, user-defined function in a program Objectives
  • 3. Modular Programming Modular programming: breaking a program up into smaller, manageable functions or modules Function: a collection of statements to perform a task Motivation for modular programming Improves maintainability of programs Simplifies the process of writing programs
  • 4. Introduction Boss to worker analogy A boss (the calling function or caller) asks a worker (the called function) to perform a task and return (i.e., report back) the results when the task is done.
  • 5. Introduction Functions are like building blocks They allow complicated programs to be divided into manageable pieces Some advantages of functions: A programmer can focus on just that part of the program and construct it, debug it, and perfect it Different people can work on different functions simultaneously Can be re-used (even in different programs) Enhance program readability
  • 6. Introduction (cont'd.) Functions Called modules Like miniature programs Can be put together to form a larger program