fork download
  1.  
  2. #include <iostream>
  3. #include <sstream>
  4. #include <string>
  5.  
  6.  
  7. int main() {
  8.  
  9. float val;
  10. std::string str;
  11. std::string temp;
  12. std::getline(std::cin,str);
  13.  
  14. std::stringstream ss(str);
  15.  
  16. while(getline(ss,temp, ' '))
  17. {
  18. std::stringstream stream(temp);
  19. if(stream >> val)
  20. std::cout<<2*val<<std::endl;
  21. else
  22. std::cout<<temp<<std::endl;
  23. }
  24.  
  25. }
  26.  
  27.  
Success #stdin #stdout 0s 4956KB
stdin
12.3 Test this hello 3.21 string
stdout
24.6
Test
this
hello
6.42
string