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
Casting
Casting
Feb 6, 2010 at 9:11am UTC
rishamessi
(46)
if the user enter
1
2
int
n ; cin >> n ;
and then i want to put the value of number of n in a string
this give me error
string str = {n} ;
what should i do ?
Feb 6, 2010 at 9:44am UTC
Warnis
(230)
You can't just put a number into a string (or vice versa) so you'd need to either write a function to do that yourself or use one that already exists(for example:
http://www.cplusplus.com/reference/clibrary/cstdlib/itoa/
)
Last edited on
Feb 6, 2010 at 9:44am UTC
Feb 6, 2010 at 10:34am UTC
blackcoder41
(1426)
http://cplusplus.com/articles/numb_to_text/
Topic archived. No new replies allowed.