Computer Science - Object Oriented Programming Using C++ - Discussion
Discussion Forum : Object Oriented Programming Using C++ - Section 5 (Q.No. 37)
37.
Which of the following tells C++ to display numbers in fixed notation?
Discussion:
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:
0x64
#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:
0x64
Himanshu said:
1 decade ago
Please show it with an example.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers