|
|
1.1 root 1: #include <errno.h>
2: #include <math.h>
3: #include <stdio.h>
4:
5: void show(value, name)
6: double value; char *name;
7: {
8: if (errno)
9: perror(name);
10: else
11: printf("%10g %s\n", value, name);
12: errno = 0;
13: }
14:
15: #define display(x) show((double)(x), #x)
16:
17: main()
18: {
19: extern char *gets();
20: double x;
21: char string[64];
22:
23: for (;;) {
24: printf("Enter a number: ");
25: fflush(stdout);
26: if (gets(string) == NULL)
27: break;
28: x = atof(string);
29: display(x);
30: display(cos(x));
31: display(sin(x));
32: display(tan(x));
33: display(acos(cos(x)));
34: }
35: putchar('\n');
36: }
37:
38:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.