c++ - How to convert multiple chars to decimal value? -
i'm trying following: have vector of chars looks like: { '3' '2' 'a' '4' '4' 'a' '9' }.
('a' place holder i've added vector denote 1 value ends , other begins)
i can't figure out how make chars 3 , 2 convert actual decimal value 32 , on 44 (9 not hard.)
now before go , rate duplicate or "we won't homework" comments start showing up, want know i've omitted other steps i've successfully completed save , time. know atoi exists in c++ we're not allowed use them (along find_first_of or sort of library functions). believe ascii can job can't seem figure out.
thanks.
the intuitive leap you're missing char number you're using encode symbol of kind, has value. figure out value of numbers 0-9, , can use translate value of type char value of type int. (richard's example above 1 way of doing that, example.)
and have digits of number, , have derive number them.
Comments
Post a Comment