c++ - Input is implicitly converted to octal -


when input user, if 0 precedes input, value automatically converted octal.

int c; cin>>c; cout<<c; 

input: 0110 output: 72

how prevent happening?

you can use std::dec

     cin >>std::dec>>c; 

Comments