char to int conversion

1
2
3
4
5
char a;   //not array
int  n;

cin>>a;
//.... 


When user enter a number in char variabla how can i convert it to number
in int variabla.
for example if user enter:5 in a variabla i need 5 in n variabla not ascii code;
try n = a-'0';
Topic archived. No new replies allowed.