C++ School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

 

Code Snippets

  

C++ Source Code


Welcome to Dream.In.Code
Become a C++ Expert!

Join 300,354 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,752 people online right now. Registration is fast and FREE... Join Now!





C++ Int to String

Program uses std::ostringstream which is defined in sstream to convert integer to string.

Submitted By: Xing
Actions:
Rating:
Views: 56,808

Language: C++

Last Modified: May 18, 2009

Snippet


  1. #include <iostream>
  2. #include <sstream>
  3.  
  4. int main() {
  5.     std::ostringstream stm;
  6.  
  7.     // Output an int
  8.     stm << 2500;
  9.  
  10.     // Retrieve the resulting string
  11.     std::cout << stm.str() ;
  12.  
  13.     return 0;
  14.   }
  15.  

Copy & Paste


Comments


Deepglue555 2009-04-16 20:02:04

what will this return?

autumn_storm2216 2009-08-07 04:34:39

can you be much defined in your codes?? it is not working all the time


Add comment


You must be registered and logged on to </dream.in.code> to leave comments.





Live C++ Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month