C++:Convert a String to a Number

From Progzoo
Revision as of 21:18, 10 April 2008 by Andr3w (Talk | contribs) (CPP:Convert a String to a Number moved to C++:Convert a String to a Number)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The first example uses the function atoi (ASCII to integer), it works on the char [] or "C String" structure.

The to convert stdlib strings you can use the >> operator on stringstream class

The value "1234" is a string, you need to treat it as a number - to add 1, giving 1235.

[Font] [Default] [Show] [Resize] [History] [Profile]