Create an input manipulator : input manipulator « Development « C++ Tutorial






#include <iostream> 
#include <iomanip> 
using namespace std; 
 
istream &customMessage(istream &stream) 
{ 
  cin >> hex; 
  cout << "Enter number using hex format: "; 
 
  return stream; 
} 
 
int main() 
{ 
  int i; 
 
  cin >> customMessage >> i; 
  cout << i; 
 
  return 0; 
}
Enter number using hex format: 0Xaa
170








5.9.input manipulator
5.9.1.Create an input manipulator