Can I add binary literal prefix in c++ before a user input int value.
#include <iostream>
using namespace std;
int main () {
int n1;
cin>>n1;
string s1 = to_string(n1);
string s2 = "0b";
string s=s2+s1;
int n=stoi(s);
cout<<n;
return 0;
}
I tried this but failed as stoi() only reads 0 and skips the rest