M4S2 Flashcards
is the process of converting one predefined
type into another.
Type Conversion
is the process of converting one predefined
type into another.
Type Conversion
When variables of one type are mixed with variables of another
type, what will occur?
a type conversion
C++ facilitates the type conversion into the following two forms:
Implicit Type Conversion
Explicit Type Conversion
also known as automatic type conversion
implicit
a conversion
performed by the compiler without programmer’s intervention.
implicit
It is applied generally whenever differing data types are intermixed in
an expression, so as not to lose information.
implicit
Conversion from one data
type to another is prone to
data loss
This happens when
data of a larger type is
converted to data of a smaller
type.
data loss
data type heirarchy
long double, double, float, long, int, short, char
When the user manually changes data from one type to another, this
is known as
explicit conversion
forces an expression to be of specific data type.
explicit conversion
is used to find
the power of the given
number
pow()
returns the square root
of value.
sqrt()
math
functions are part of
X header.
both
are used to retrieve or calculate
the absolute value
abs() and fabs () functions
X is used
to calculate the absolute value for
integer type numbers
abs()
X are used for
floating type numbers.
fabs()
map a real number
to the greatest preceding or
the least succeeding integer,
respectively
The floor and ceiling
functions
is used to round the value toward
zero and returns the nearest
integral value.
trunc()
is used to round the
given number to the closest
integer.
round()
sets the decimal precision to be used to format
floating-point values on output operations
setprecision
setprecision when used along with X provides precision to
floating point numbers correct to decimal numbers mentioned in the
brackets of the setprecision.
‘fixed’
setprecision function is part of X header
When variables of one type are mixed with variables of another
type, what will occur?
a type conversion
C++ facilitates the type conversion into the following two forms:
Implicit Type Conversion
Explicit Type Conversion
also known as automatic type conversion
implicit
a conversion
performed by the compiler without programmer’s intervention.
implicit
It is applied generally whenever differing data types are intermixed in
an expression, so as not to lose information.
implicit
Conversion from one data
type to another is prone to
data loss
This happens when
data of a larger type is
converted to data of a smaller
type.
data loss
data type heirarchy
long double, double, float, long, int, short, char
When the user manually changes data from one type to another, this
is known as
explicit conversion
forces an expression to be of specific data type.
explicit conversion
is used to find
the power of the given
number
pow()
returns the square root
of value.
sqrt()
math
functions are part of
X header.
both
are used to retrieve or calculate
the absolute value
abs() and fabs () functions
X is used
to calculate the absolute value for
integer type numbers
abs()
X are used for
floating type numbers.
fabs()
map a real number
to the greatest preceding or
the least succeeding integer,
respectively
The floor and ceiling
functions
is used to round the value toward
zero and returns the nearest
integral value.
trunc()
is used to round the
given number to the closest
integer.
round()
sets the decimal precision to be used to format
floating-point values on output operations
setprecision
setprecision when used along with X provides precision to
floating point numbers correct to decimal numbers mentioned in the
brackets of the setprecision.
‘fixed’
setprecision function is part of X header