Q. The function contain in the ios class to set width
In C++ (especially with <iostream>), the ios class provides various functions to control the formatting of input and output. Here's what each option does:
width()
Sets the field width (i.e., the minimum number of characters to be used for the next output).
β
This is used to set the width.
precision()
Sets the number of digits to display after the decimal point for floating-point values.
fill()
Sets the character used to fill unused width space (default is space ' ').
setf()
Sets format flags (e.g., std::ios::left, std::ios::right, std::ios::fixed, etc.).
β Correct Answer: (A) width()
std::cout.width(10); // sets width to 10 for the next output
std::cout << 123 << std::endl;