#include <iostream>
#include <iomanip>
using namespace std;
int main ()
{
int a = 21;
cout.unsetf (ios::dec);//if i delete this line ,the result is 21,
cout.setf (ios::hex);//why not it shows in hex, that is 15 ?
cout << a << endl;
return 0;
}
...全文
786打赏收藏
hex and dec 's default transfer
#include #include using namespace std; int main () { int a = 21; cout.unsetf (ios::dec);//if i delete this line ,the result is 21, cout.setf (ios::hex);//why not it shows in hex, that is 15 ? cout << a << endl; return 0; }
the "pinyin shu ru fa' on my computer has been overloaded ,but i do not konw how to setup it
so i have to use english even though my english is not very good !!
i konw it,but i cann't understand that why the result is 21 if i delete this line :
" cout.unsetf (ios::dec); "
i think it shoud cout in hex, that is : 15