fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. char string[255] = " 2.34 5.21 7.22\n";
  6. float x,y,z;
  7. sscanf(string, " %f %f %f\n",&x,&y,&z);
  8.  
  9. cout << x << " " << y << " " << z << endl;
  10. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
2.34 5.21 7.22