It throws an error as I have started initialization with a 0 which makes it octal but then 9 is not an octal.Code:#include<iostream> //Call it 1st using namespace std; int main() { int i=019; cout<<i<<endl; return 0; }
It works fine even when the input is 019? --> why is there any difference in functioning?Code:#include<iostream> //Call it 2nd using namespace std; int main() { int i; cin>>i; cout<<i<<endl; return 0; }
+
I got this that method of solving error due to combination of octal & 9 is to take input from cin but is there any other method?
+
How can I give an input to cin in octal?