#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
char s[] = "4.5, 98.591, 8981.4 -2.1989 35.6";
char *pos = s;
while (pos != s + strlen(s)) {
float f = strtof(pos, &pos);
while (*pos == ' ' || *pos == ',') {
pos++;
}
printf("%.4f\n", f);
}
return 0;
}
/*
run:
4.5000
98.5910
8981.4004
-2.1989
35.6000
*/