fork download
  1. #include <stdio.h>
  2. #include <float.h>
  3. #include <math.h>
  4.  
  5. static void test_scanf(const char *s)
  6. {
  7. double x1, x2;
  8.  
  9. if ((sscanf(s, "%lf %lf", &x1, &x2)) == 2)
  10. {
  11. printf("%s -> %f, %f\n", s, x1, x2);
  12. }
  13. else
  14. {
  15. printf("%s: invalid input.\n", s);
  16. }
  17. }
  18.  
  19. int main(void)
  20. {
  21. test_scanf("1495.952 934.023");
  22. }
  23.  
Success #stdin #stdout 0s 9432KB
stdin
Standard input is empty
stdout
1495.952 934.023 -> 1495.952000, 934.023000