Computer Science - Object Oriented Programming Using C++ - Discussion

Discussion Forum : Object Oriented Programming Using C++ - Section 5 (Q.No. 37)
Which of the following tells C++ to display numbers in fixed notation?
setiosflags(fixed: :is)
setiosflags(ios, fixed)
Answer: Option
No answer description is available. Let's discuss.
2 comments Page 1 of 1.

Gagan said:   1 decade ago
// modify flags
#include <iostream>
using namespace std;

int main () {
cout.flags ( ios::right | ios::hex | ios::showbase );
cout.width (10);
cout << 100;
return 0;

This simple example sets some format flags for cout that affect the latter insertion operation by printing the value in hexadecimal base format (0x64) padded right as in a field ten spaces long:


Himanshu said:   1 decade ago
Please show it with an example.

Post your comments here:

Your comments will be displayed after verification.