cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
char to int conversion
char to int conversion
May 8, 2009 at 5:14pm UTC
jasmin m
(15)
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;
May 8, 2009 at 5:17pm UTC
Bazzy
(6281)
try
n = a-
'0'
;
Topic archived. No new replies allowed.