What  happens if you try to compile and run this program?

Last Updated on May 22, 2022 by Admin 3

What  happens if you try to compile and run this program?

#include <iostream>
using namespace std;
int
main()
{
  ​​cout << 31 << ", ";
  cout.setf (ios::hex, ios::basefield);
  cout.setf (ios::showbase); //LINE I
  cout << 31 << ", ";
  cout.unsetf (ios::showbase); //LINE II
  cout << 63 << ", ";
  return 0;
}
  • the program outputs 31, 31, 3f,
  • compilation error in LINE II
  • runtime error at LINE I
  • compilation error in LINE I 
  • the program outputs 31, 31, 63
  • the program outputs 31, 0x1f, 3f,
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments