SlideShare a Scribd company logo
{
}
The Presentation Owners :
Alan Mahmood
Sumaya Mohamed
Rebin Faisal
Rozh Ebrahim
Zina Maaruf
...
Functions In C++
Supervised By:
Dr. Chiman Haidar
Contents :
• Introduction About Function In C++
• Function Declaration And Definition
• Parameters In C++ Function
• Return Task In Function
• Default Argument
• Function Overloading
• Some Libraries In C++ Function
• Program Example 1
• Program Example 2
Introduction About {Functions}
A function is a set of statements
that takes input, does some
specific computation, and
produces output. The idea is to put
some commonly or
repeatedly done tasks together to
make a {function} so that instead
of writing the same code again
and again for different inputs, we
can call this function.
In simple terms, a function is a
block of code that runs only when
it is called.
Function
Declaration And
Definition
// Function declaration
int add(int a, int
b);
// Function definition
int add(int a, int b)
{
return a + b;
}
}
{
Parameters
In Function A parameter is a special kind of
variable used in a function to refer
to one of the pieces of data
provided as input to the function.
These pieces of data are the values
of the arguments with which the
function is going to be
called/invoked.
Parameters In {Functions}
A parameter is a special
kind of variable used in
a function to refer to
one of the pieces of data
provided as input to the
function. These pieces
of data are the values of
the arguments with
which the function is
going to be
#include <iostream>
// Function returning an integer
int square(int num) {
return num * num;
}
// Function returning a double
double calculateAverage(double a, double b) {
return (a + b) / 2.0;
}
Return Task {Functions}
Default Argument in {Functions}
#include <iostream>
// Function with default argument
void printNumber(int num = 10) {
std::cout << "Number: " << num << std::endl;
}
int main() {
// Function call without providing an argument
printNumber(); // Uses the default value (10)
return 0;
}
{Function} Overloading
Function overloading is a feature of object-oriented
programming where two or more functions can have the same
name but different parameters. When a function name is
overloaded with different jobs it is called Function Overloading.
In Function Overloading “Function” name should be the same
and the arguments should be different. Function overloading
can be considered as an example of a polymorphism feature in
C++.
{Function} Overloading
#include <iostream>
// Function overloading
int add(int a, int b) {
return a + b;
}
double add(double a, double b) {
return a + b;
}
Call The Functions
Into Main Function
{Function} Overloading
int main() {
int result_int = add(3, 4);
double result_double = add(3.5, 4.2);
std::cout << "Sum (int): " << result_int << std::endl;
std::cout << "Sum (double): " << result_double <<
std::endl;
return 0;
}
Some Libraries Of {Functions} In C++
Stdio.h Conio.h String.h
Math.h Ctype.h Time.h
Program Example 1
#include <iostream>
#include <cmath>
Using namespace std;
// Function to calculate the area of a rectangle
double calculateRectangleArea(double length, double width) {
return length * width;
}
// Function to calculate the area of a circle
double calculateCircleArea(double radius) {
return Pi * pow(radius, 2);
}
}
Out Of the Main
Function
A program That measures The area of
rectangle and a circuit By user :
int main() {
// Input for rectangle
double rectLength, rectWidth;
cout << "Enter length and width of the rectangle: ";
cin >> rectLength >> rectWidth;
// Calculate and display rectangle area
cout << "Area of the rectangle: " << calculateRectangleArea(rectLength, rectWidth) << endl;
// Input for circle
double circleRadius;
cout << "Enter the radius of the circle: ";
cin >> circleRadius;
// Calculate and display circle area
cout << "Area of the circle: " << calculateCircleArea(circleRadius) << endl;
return 0;
}
The Output By user
Enter length and width of the rectangle: 53
Area of the rectangle: 15
Enter the radius of the circle: 2
Area of the circle: 12.5664
Program Example 2
#include <iostream>
#include <string>
Using namespace std;
int main() {
// Declare and initialize a string
string greeting = "Hello ";
// Concatenate another string
greeting += "World!";
// Display the concatenated string
cout << greeting << endl;
// Find the length of the string
cout << "Length of the string: " << greeting.length() << endl;
12
compiler
Hello world!
Compiler
A program to determine
string length and first
character and last character
and string attend
condition(if)
// Access individual characters in the string
cout << "First character: " << greeting[0] << endl;
cout << "Last character: " << greeting.back() << endl;
// Check if the string is empty
if (greeting.empty()) {
cout << "The string is empty." << endl;
} else {
cout << "The string is not empty." << endl;
}
return 0;
}
The Output
• Hello, World!
• Length of the string: 12
• First character: H
• Last character: !
• The string is not empty

Ad

More Related Content

Similar to Functions in C++ programming language.pptx (20)

Chapter 4
Chapter 4Chapter 4
Chapter 4
temkin abdlkader
 
Object Oriented Programming using C++: Ch08 Operator Overloading.pptx
Object Oriented Programming using C++: Ch08 Operator Overloading.pptxObject Oriented Programming using C++: Ch08 Operator Overloading.pptx
Object Oriented Programming using C++: Ch08 Operator Overloading.pptx
RashidFaridChishti
 
unit_2.pptx
unit_2.pptxunit_2.pptx
unit_2.pptx
Venkatesh Goud
 
16717 functions in C++
16717 functions in C++16717 functions in C++
16717 functions in C++
LPU
 
Programming Fundamentals lecture-10.pptx
Programming Fundamentals lecture-10.pptxProgramming Fundamentals lecture-10.pptx
Programming Fundamentals lecture-10.pptx
singyali199
 
C++ functions
C++ functionsC++ functions
C++ functions
Dawood Jutt
 
C++ functions
C++ functionsC++ functions
C++ functions
Dawood Jutt
 
C++ Functions.pptx
C++ Functions.pptxC++ Functions.pptx
C++ Functions.pptx
DikshaDani5
 
Fundamental of programming Fundamental of programming
Fundamental of programming Fundamental of programmingFundamental of programming Fundamental of programming
Fundamental of programming Fundamental of programming
LidetAdmassu
 
Chapter 1 (2) array and structure r.pptx
Chapter 1 (2) array and structure r.pptxChapter 1 (2) array and structure r.pptx
Chapter 1 (2) array and structure r.pptx
abenezertekalign118
 
Fp201 unit5 1
Fp201 unit5 1Fp201 unit5 1
Fp201 unit5 1
rohassanie
 
function in in thi pdf you will learn what is fu...
function in  in thi pdf you will learn   what                           is fu...function in  in thi pdf you will learn   what                           is fu...
function in in thi pdf you will learn what is fu...
kushwahashivam413
 
unit_2 (1).pptx
unit_2 (1).pptxunit_2 (1).pptx
unit_2 (1).pptx
JVenkateshGoud
 
Intro to c++
Intro to c++Intro to c++
Intro to c++
temkin abdlkader
 
Ch-4-Operator Overloading.pdf
Ch-4-Operator Overloading.pdfCh-4-Operator Overloading.pdf
Ch-4-Operator Overloading.pdf
esuEthopi
 
chapter-8-function-overloading.pdf
chapter-8-function-overloading.pdfchapter-8-function-overloading.pdf
chapter-8-function-overloading.pdf
study material
 
Classes function overloading
Classes function overloadingClasses function overloading
Classes function overloading
ankush_kumar
 
C++ Function
C++ FunctionC++ Function
C++ Function
Hajar
 
cppt-170218053903.pptxhjkjhjjjjjjjjjjjjjjj
cppt-170218053903.pptxhjkjhjjjjjjjjjjjjjjjcppt-170218053903.pptxhjkjhjjjjjjjjjjjjjjj
cppt-170218053903.pptxhjkjhjjjjjjjjjjjjjjj
supriyaharlapur1
 
Functionincprogram
FunctionincprogramFunctionincprogram
Functionincprogram
Sampath Kumar
 
Object Oriented Programming using C++: Ch08 Operator Overloading.pptx
Object Oriented Programming using C++: Ch08 Operator Overloading.pptxObject Oriented Programming using C++: Ch08 Operator Overloading.pptx
Object Oriented Programming using C++: Ch08 Operator Overloading.pptx
RashidFaridChishti
 
16717 functions in C++
16717 functions in C++16717 functions in C++
16717 functions in C++
LPU
 
Programming Fundamentals lecture-10.pptx
Programming Fundamentals lecture-10.pptxProgramming Fundamentals lecture-10.pptx
Programming Fundamentals lecture-10.pptx
singyali199
 
C++ Functions.pptx
C++ Functions.pptxC++ Functions.pptx
C++ Functions.pptx
DikshaDani5
 
Fundamental of programming Fundamental of programming
Fundamental of programming Fundamental of programmingFundamental of programming Fundamental of programming
Fundamental of programming Fundamental of programming
LidetAdmassu
 
Chapter 1 (2) array and structure r.pptx
Chapter 1 (2) array and structure r.pptxChapter 1 (2) array and structure r.pptx
Chapter 1 (2) array and structure r.pptx
abenezertekalign118
 
function in in thi pdf you will learn what is fu...
function in  in thi pdf you will learn   what                           is fu...function in  in thi pdf you will learn   what                           is fu...
function in in thi pdf you will learn what is fu...
kushwahashivam413
 
Ch-4-Operator Overloading.pdf
Ch-4-Operator Overloading.pdfCh-4-Operator Overloading.pdf
Ch-4-Operator Overloading.pdf
esuEthopi
 
chapter-8-function-overloading.pdf
chapter-8-function-overloading.pdfchapter-8-function-overloading.pdf
chapter-8-function-overloading.pdf
study material
 
Classes function overloading
Classes function overloadingClasses function overloading
Classes function overloading
ankush_kumar
 
C++ Function
C++ FunctionC++ Function
C++ Function
Hajar
 
cppt-170218053903.pptxhjkjhjjjjjjjjjjjjjjj
cppt-170218053903.pptxhjkjhjjjjjjjjjjjjjjjcppt-170218053903.pptxhjkjhjjjjjjjjjjjjjjj
cppt-170218053903.pptxhjkjhjjjjjjjjjjjjjjj
supriyaharlapur1
 

Recently uploaded (20)

Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
Top 10 IT Help Desk Outsourcing Services
Top 10 IT Help Desk Outsourcing ServicesTop 10 IT Help Desk Outsourcing Services
Top 10 IT Help Desk Outsourcing Services
Infrassist Technologies Pvt. Ltd.
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Unlocking the Power of IVR: A Comprehensive Guide
Unlocking the Power of IVR: A Comprehensive GuideUnlocking the Power of IVR: A Comprehensive Guide
Unlocking the Power of IVR: A Comprehensive Guide
vikasascentbpo
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
Social Media App Development Company-EmizenTech
Social Media App Development Company-EmizenTechSocial Media App Development Company-EmizenTech
Social Media App Development Company-EmizenTech
Steve Jonas
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Vaibhav Gupta BAML: AI work flows without Hallucinations
Vaibhav Gupta BAML: AI work flows without HallucinationsVaibhav Gupta BAML: AI work flows without Hallucinations
Vaibhav Gupta BAML: AI work flows without Hallucinations
john409870
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Mastering Advance Window Functions in SQL.pdf
Mastering Advance Window Functions in SQL.pdfMastering Advance Window Functions in SQL.pdf
Mastering Advance Window Functions in SQL.pdf
Spiral Mantra
 
MINDCTI revenue release Quarter 1 2025 PR
MINDCTI revenue release Quarter 1 2025 PRMINDCTI revenue release Quarter 1 2025 PR
MINDCTI revenue release Quarter 1 2025 PR
MIND CTI
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Unlocking the Power of IVR: A Comprehensive Guide
Unlocking the Power of IVR: A Comprehensive GuideUnlocking the Power of IVR: A Comprehensive Guide
Unlocking the Power of IVR: A Comprehensive Guide
vikasascentbpo
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
Social Media App Development Company-EmizenTech
Social Media App Development Company-EmizenTechSocial Media App Development Company-EmizenTech
Social Media App Development Company-EmizenTech
Steve Jonas
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Vaibhav Gupta BAML: AI work flows without Hallucinations
Vaibhav Gupta BAML: AI work flows without HallucinationsVaibhav Gupta BAML: AI work flows without Hallucinations
Vaibhav Gupta BAML: AI work flows without Hallucinations
john409870
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Mastering Advance Window Functions in SQL.pdf
Mastering Advance Window Functions in SQL.pdfMastering Advance Window Functions in SQL.pdf
Mastering Advance Window Functions in SQL.pdf
Spiral Mantra
 
MINDCTI revenue release Quarter 1 2025 PR
MINDCTI revenue release Quarter 1 2025 PRMINDCTI revenue release Quarter 1 2025 PR
MINDCTI revenue release Quarter 1 2025 PR
MIND CTI
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Ad

Functions in C++ programming language.pptx

  • 1. { } The Presentation Owners : Alan Mahmood Sumaya Mohamed Rebin Faisal Rozh Ebrahim Zina Maaruf ... Functions In C++ Supervised By: Dr. Chiman Haidar
  • 2. Contents : • Introduction About Function In C++ • Function Declaration And Definition • Parameters In C++ Function • Return Task In Function • Default Argument • Function Overloading • Some Libraries In C++ Function • Program Example 1 • Program Example 2
  • 3. Introduction About {Functions} A function is a set of statements that takes input, does some specific computation, and produces output. The idea is to put some commonly or repeatedly done tasks together to make a {function} so that instead of writing the same code again and again for different inputs, we can call this function. In simple terms, a function is a block of code that runs only when it is called.
  • 4. Function Declaration And Definition // Function declaration int add(int a, int b); // Function definition int add(int a, int b) { return a + b; }
  • 5. } { Parameters In Function A parameter is a special kind of variable used in a function to refer to one of the pieces of data provided as input to the function. These pieces of data are the values of the arguments with which the function is going to be called/invoked.
  • 6. Parameters In {Functions} A parameter is a special kind of variable used in a function to refer to one of the pieces of data provided as input to the function. These pieces of data are the values of the arguments with which the function is going to be
  • 7. #include <iostream> // Function returning an integer int square(int num) { return num * num; } // Function returning a double double calculateAverage(double a, double b) { return (a + b) / 2.0; } Return Task {Functions}
  • 8. Default Argument in {Functions} #include <iostream> // Function with default argument void printNumber(int num = 10) { std::cout << "Number: " << num << std::endl; } int main() { // Function call without providing an argument printNumber(); // Uses the default value (10) return 0; }
  • 9. {Function} Overloading Function overloading is a feature of object-oriented programming where two or more functions can have the same name but different parameters. When a function name is overloaded with different jobs it is called Function Overloading. In Function Overloading “Function” name should be the same and the arguments should be different. Function overloading can be considered as an example of a polymorphism feature in C++.
  • 10. {Function} Overloading #include <iostream> // Function overloading int add(int a, int b) { return a + b; } double add(double a, double b) { return a + b; } Call The Functions Into Main Function
  • 11. {Function} Overloading int main() { int result_int = add(3, 4); double result_double = add(3.5, 4.2); std::cout << "Sum (int): " << result_int << std::endl; std::cout << "Sum (double): " << result_double << std::endl; return 0; }
  • 12. Some Libraries Of {Functions} In C++ Stdio.h Conio.h String.h Math.h Ctype.h Time.h
  • 13. Program Example 1 #include <iostream> #include <cmath> Using namespace std; // Function to calculate the area of a rectangle double calculateRectangleArea(double length, double width) { return length * width; } // Function to calculate the area of a circle double calculateCircleArea(double radius) { return Pi * pow(radius, 2); } } Out Of the Main Function A program That measures The area of rectangle and a circuit By user :
  • 14. int main() { // Input for rectangle double rectLength, rectWidth; cout << "Enter length and width of the rectangle: "; cin >> rectLength >> rectWidth; // Calculate and display rectangle area cout << "Area of the rectangle: " << calculateRectangleArea(rectLength, rectWidth) << endl; // Input for circle double circleRadius; cout << "Enter the radius of the circle: "; cin >> circleRadius; // Calculate and display circle area cout << "Area of the circle: " << calculateCircleArea(circleRadius) << endl; return 0; }
  • 15. The Output By user Enter length and width of the rectangle: 53 Area of the rectangle: 15 Enter the radius of the circle: 2 Area of the circle: 12.5664
  • 16. Program Example 2 #include <iostream> #include <string> Using namespace std; int main() { // Declare and initialize a string string greeting = "Hello "; // Concatenate another string greeting += "World!"; // Display the concatenated string cout << greeting << endl; // Find the length of the string cout << "Length of the string: " << greeting.length() << endl; 12 compiler Hello world! Compiler A program to determine string length and first character and last character and string attend condition(if)
  • 17. // Access individual characters in the string cout << "First character: " << greeting[0] << endl; cout << "Last character: " << greeting.back() << endl; // Check if the string is empty if (greeting.empty()) { cout << "The string is empty." << endl; } else { cout << "The string is not empty." << endl; } return 0; }
  • 18. The Output • Hello, World! • Length of the string: 12 • First character: H • Last character: ! • The string is not empty
  • 19.