value.cppThis program reads a double floating-point value followed by a single suffix character from a null-terminated string. The strings are obtained from command line arguments.
This version uses standard I/O streams.
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int i;
double v;
char c;
for (i=1; i<argc; i++) {
sscanf_s(argv[i],"%Le%c",&v,&c);
printf("%s: %g %c\n",argv[i],v,c);
}
return EXIT_SUCCESS;
}
C:\classes\ece538\work\netlist1>value 15 21e-4 1K 300MEG 15ns 15: 15 21e-4: 0.0021 1K: 1 K 300MEG: 300 M 15ns: 15 n
Maintained by John Loomis, updated Sat Jan 06 21:32:28 2007