0% found this document useful (0 votes)
47 views10 pages

C++ Built-in Functions Overview

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

C++ Built-in Functions Overview

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

Faculty of Computer Science

Introduction to Programming

Lecturer: Lutfullah “Haqnesar”


Introduction to Programming

Chapter 9

Built-in Functions
Introduction to Programming
Learning outcomes:
 Function
 Types of function
 String functions
• Strcat(), Strcpy()
• Strupr(), Strlwr()
 Arithmetic functions
• Sqrt(), Pow()
• Round(), Abs()
• Max(), min()
• Sin(), cos()
What is function?

 A function is block of code which is used to perform a


particular task.
We have two types of function in C++:

Build-in
function
Function
User defined
function
Types of Functions

1. Build-in function:
A function which has been created already and programmers are able to
use in their own programs. Also know as library function.

2. User defined function:


A function which created by the programmer for his own purpose is
called as User Defined Function.
Built-in function

Built-in functions can be further categories into two parts:

1. Arithmetic Library Functions

2. String Library Functions


1.1 Arithmetic Library Functions

Method Description
sqrt(x) Return square root value of a number
pow(x, y) It computes x raised to the power y.
round(x) It rounds off the value of x.
max(x, y) It returns the larger number among two numbers x and y.
min(x, y) It returns the smaller number among two numbers x and y.
abs(x) It computes the absolute value of x.
1.1 Arithmetic Library Functions

Method Description
abs(x) It computes the absolute value of x.
sin(x) It computes the cosine of x.
cos(x) It computes the sine of x.
tan(x) It computes the tangent of x.
1.2 String Library Function

Method Description
Strlen() Calculates the length of a string. It returns the number of
characters in a string.
strlwr(x) Converts the uppercase letters of a string to lowercase.
strupr(y) strupr() converts the lowercase letters of a string to uppercase.
Strcpy(x, y) It copies one string to another.
Strcat(x, y) Appends a copy of the source string to the destination string.

You might also like