with solutions 2025
& - ANSWER Address Operator (returns address of values), Reference Operator, Part of And
(&&)
<< - ANSWER Used with cout
>> - ANSWER Used with cin
void - ANSWER Basically it means "nothing" or "no type"
There are 3 basic ways that void is used:
Function argument: int myFunc(____) -- the function takes nothing.
Function return value: ____ myFunc(int) -- the function returns nothing
Generic data pointer: void* data -- 'data' is a pointer to data of unknown type, and cannot be
dereferenced
Note: the void in a function argument is optional in C++, so int myFunc() is exactly the same as
int myFunc(____), and it is left out completely in C#. It is always required for a return value.
{} - ANSWER Delimits a scope
| - ANSWER or
setw(n) - ANSWER Sets the field width to be used on output operations.
,Behaves as if member width were called with n as argument on the stream on which it is
inserted/extracted as a manipulator (it can be inserted/extracted on input streams or output
streams).
This manipulator is declared in header <iomanip>.
setprecision(n) - ANSWER Sets the decimal precision to be used to format floating-point values
on output operations.
Behaves as if member precision were called with n as argument on the stream on which it is
inserted/extracted as a manipulator (it can be inserted/extracted on input streams or output
streams).
This manipulator is declared in header <iomanip>.
fixed - ANSWER Use fixed floating-point notation
Sets the floatfield format flag for the str stream to fixed.
When floatfield is set to fixed, floating-point values are written using fixed-point notation: the
value is represented with exactly as many digits in the decimal part as specified by the precision
field (precision) and with no exponent part.
scientific - ANSWER Sets the floatfield format flag for the str stream to scientific.
When floatfield is set to scientific, floating-point values are written using scientific notation: the
value is represented always with only one digit before the decimal point, followed by the
decimal point and as many decimal digits as the precision field (precision). Finally, this notation
always includes an exponential part consisting on the letter e followed by an optional sign and
three exponential digits.
, setfill('.') - ANSWER /*unspecified*/ _______ (char_type c);
Set fill character
Sets c as the stream's fill character.
Behaves as if member fill were called with c as argument on the stream on which it is inserted
as a manipulator (it can be inserted on output streams).
This manipulator is declared in header <iomanip>.
right - ANSWER ios_base& right (ios_base& str);
Adjust output to the right
Sets the adjustfield format flag for the str stream to right.
When adjustfield is set to right, the output is padded to the field width (width) by inserting fill
characters (fill) at the beginning, effectively adjusting the field to the right.
The adjustfield format flag can take any of the following values (each with its own manipulator):
left - ANSWER ios_base& left (ios_base& str);
Adjust output to the left
Sets the adjustfield format flag for the str stream to left.