-2
I have the program below:
#include <iostream>
#include <sstream>
namespace std
{
int bin(int n)
{
if(n!=0)bin(n/2);
if(n!=0)std::cout<<n%2;
}
}
int main()
{
int n;
std::istringstream("2a") >> std::hex >> n;
std::cout << "Number 42 in octal: " << std::oct << 42 <<"\n"
<< "Number 42 in decimal: " << std::dec << 42 <<"\n"
<< "Number 42 in hex: " << std::hex << 42 <<"\n"
<< std::dec << "Hexa 2a in decimal: " << n << '\n';
//std::cout<< "Number 42 in bin: " << std::bin << 42 <<"\n";
//std::cout<< "Number 42 in bin: " << std::bin>> 42 <<"\n";
return 0;
}
how to do to the operator of an istream and ostream so that it is possible
int c=10;
int d;
std::bin<<c<<std::endl;
std::bin<<10<<std::endl;
or
std::bin>>d;
the question is poorly worded but it is interesting
– zentrunix