B
Bill Cunningham
I have create these 2 files. Called main.c and atr.c. They seem to work
pretty well. I just wanted to submit them to see what if any errors others
that know more might find. Thanks.
atr.c
#include <stdio.h>
double
atr (double th, double tl, double wc)
{
if (th - tl > th - wc && tl - wc < th - tl)
{
return th - tl;
}
if (th - wc > th - tl && tl - wc < th - wc)
{
return th - wc;
}
if (tl - wc > th - wc && th - tl < tl - wc)
{
return tl - wc;
}
}
main.c
#include <stdio.h>
#include <stdlib.h>
extern double atr ( double th, double tl, double wc );
int
main (int argc, char *argv[])
{
if (argc != 4)
{
fprintf (stderr, "usage error th, tl, wc\n");
exit (EXIT_FAILURE);
}
double th, tl, wc;
th = strtod (argv[1], NULL);
tl = strtod (argv[2], NULL);
wc = strtod (argv[3], NULL);
printf("%.2f\n", atr(th, tl, wc));
}
Bill
pretty well. I just wanted to submit them to see what if any errors others
that know more might find. Thanks.
atr.c
#include <stdio.h>
double
atr (double th, double tl, double wc)
{
if (th - tl > th - wc && tl - wc < th - tl)
{
return th - tl;
}
if (th - wc > th - tl && tl - wc < th - wc)
{
return th - wc;
}
if (tl - wc > th - wc && th - tl < tl - wc)
{
return tl - wc;
}
}
main.c
#include <stdio.h>
#include <stdlib.h>
extern double atr ( double th, double tl, double wc );
int
main (int argc, char *argv[])
{
if (argc != 4)
{
fprintf (stderr, "usage error th, tl, wc\n");
exit (EXIT_FAILURE);
}
double th, tl, wc;
th = strtod (argv[1], NULL);
tl = strtod (argv[2], NULL);
wc = strtod (argv[3], NULL);
printf("%.2f\n", atr(th, tl, wc));
}
Bill