/**
* sin.c
* Compute the sine of a number entered on the command line.
*
* Copyright (c) 2015 Samuel A. Rebelsky and the members of
* CSC 282. All rights reserved.
*
* This file is part of SRMath, SamR's simple math library.
*
* SRMath is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* SRMath is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with SRMath. If not, see .
*/
// +-------+-----------------------------------------------------------
// | Notes |
// +-------+
/*
o The program does not currently verify that the values entered on the
command line are integers. It should do so.
*/
// +---------+---------------------------------------------------------
// | Headers |
// +---------+
#include // For atol
#include // For printf and such
#include // For sin
// +------+------------------------------------------------------------
// | Main |
// +------+
int
main (int argc, char *argv[])
{
int i; // Generic counter variable
// Sanity check
if (argc <= 1)
{
fprintf (stderr, "Usage: sin VAL1 VAL2 ... VALN\n");
return 1;
}
for (i = 1; i < argc; i++)
{
double d = atof (argv[i]);
printf ("sin(%lf) = %lf\n", d, sin(d));
} // for
// And we're done.
return 0;
} // main