Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. #include <sstream>
  4. ///includujemy stringowe strumyczki
  5.  
  6. std::stringstream strumyk;
  7. ///strumyczek
  8.  
  9. int main()
  10. {
  11.     /// --- KONWERSJA STRING -> LICZBA( FLOAT, INT, LONG, itp. )
  12.    
  13.     float numbah;
  14.     strumyk << "21.37";
  15.     ///ladujemy do strumyka liczbe w postaci tekstu
  16.     strumyk >> numbah;
  17.     ///wyciagamy ze strumyka liczbe i nadajemy ja zmiennej numbah
  18.    
  19.  
  20.    
  21.     /// --- KONWERSJA LICZBA(J.W.) -> STRING
  22.    
  23.     std::string leet;
  24.     int xd = 1337;
  25.     strumyk << xd;
  26.     ///ladujemy liczbe do strumyka
  27.     leet << xd;
  28.     ///i wyciagamy stringa
  29.    
  30.  
  31.  
  32.     std::cout << numbah;
  33.     std::cout << xd;
  34.     /// no i elo
  35.  
  36.     return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement