c++进制没有改变什么情况
#include<iostream>#include<climits>
#include<cmath>
int main()
{
using namespace std;
int ch=42;
int wa=0x42;
int in=042;
cout<<"ch= "<<ch<<endl;
cout<<"wa= "<<ch<<"\n";
cout<<"in= "<<ch<<endl;
cout<<"chest= "<<ch<<endl;
cout<<hex;
cout<<"wa= "<<wa<<endl;
cout<<oct;
cout<<"in= "<<in<<endl;
return 0;
}
为什么我的结果是这样? 不应该是区分8,16进制的吗?为66,34吗?
ch= 42
wa= 42
in= 42
chest= 42
wa= 42
in= 42
Press any key to continue