s1ay3r44

Float -> String

Sep 11th, 2013
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.19 KB | None | 0 0
  1. #include <iostream>
  2. #include <sstream>
  3.  
  4.  
  5. int main(){
  6.     float n = 3.141526f;
  7.     std::string s;
  8.     std::stringstream stream;
  9.    
  10.     stream << n;
  11.     stream >> s;
  12.  
  13.     std::cout << s;
  14.  
  15.     std::cin.get();
  16.  
  17.     return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment