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
How to int from string?
How to int from string?
Oct 19, 2013 at 9:18pm UTC
Jose94ji
(63)
I need help in doing this for class. So, lets say a user inputs a string "1234" how would i be able to add 2 to each number individually? so the it would look like this after ward "3456". Thanks in advance.
Oct 19, 2013 at 11:24pm UTC
admkrk
(505)
Think of a string as a char array with 4 elements (in your example). Then either cast each element to int and add 2 or add 50.
Topic archived. No new replies allowed.