mostly-standard scanf
This commit is contained in:
parent
1ea9d85e3f
commit
f973ff8cb8
4 changed files with 433 additions and 47 deletions
12
05/main.c
12
05/main.c
|
@ -3,11 +3,13 @@
|
|||
#include <string.h>
|
||||
|
||||
int main(void) {
|
||||
char *s = "1.35984534e135-e12hello";
|
||||
char *end;
|
||||
_Float f = _powers_of_10[-307];
|
||||
printf("%.15g\n",strtod(s, &end));
|
||||
printf("%s\n",end);
|
||||
int count; float quant; char units[21], item[21];
|
||||
while (!feof(stdin) && !ferror(stdin)) {
|
||||
count = fscanf(stdin, "%f%20s of %20s",
|
||||
&quant, units, item);
|
||||
fscanf(stdin,"%*[^\n]");
|
||||
printf("%d %g %s %s\n", count, quant, units, item);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue