1 // A simple program that builds a sqrt table
5 int main (int argc
, char *argv
[])
10 // make sure we have enough arguments
16 // open the output file
17 FILE *fout
= fopen(argv
[1],"w");
23 // crate a source file with a table of square roots
24 fprintf(fout
,"double sqrtTable[] = {\n");
25 for (i
= 0; i
< 10; ++i
)
27 result
= sqrt(static_cast<double>(i
));
28 fprintf(fout
,"%g,\n",result
);
31 // close the table with a zero
32 fprintf(fout
,"0};\n");