Possible Duplicate:
convert string to integer in c++
Convert a no. from string to integer.
Eg: str:”1234″
convert to int a=1234;
i want the hint with proper explaination
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The technique that this task is probably trying to get at is accessing each of the digits, e.g.,
str[0] - '0' = 1and multiply by their place values. But atoi is much faster!