53 lines
No EOL
1.4 KiB
C
53 lines
No EOL
1.4 KiB
C
// header files
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <math.h>
|
|
|
|
// local constants
|
|
|
|
/*
|
|
Name: Temperature Chart
|
|
Process: Accepts up to three numbers and prints out the Fahrenheit and Celcius
|
|
degrees between the two numbers, with an optional step as third number.
|
|
Function input/parameters: argc and argv command line parameters
|
|
Function output/parameters: NONE
|
|
Function output/returned: NONE
|
|
Device input/---: NONE
|
|
Device output/---: NONE
|
|
Dependencies: included by standard libraries
|
|
*/
|
|
int main(int argc, char *argv[])
|
|
{
|
|
// define local variables
|
|
double start = atof(argv[1]), stop = atof(argv[2]);
|
|
int step = 1;
|
|
int tempIterator;
|
|
// do calculations
|
|
if(argc == 3 || argc == 2)
|
|
{
|
|
// do the temperature chart stuff here
|
|
// check to see if a step is provided
|
|
if(argc == 3)
|
|
{
|
|
step = atof(argv[3]);
|
|
}
|
|
// do the printing and looping
|
|
printf("%f\t%f\n", start, start);
|
|
for(tempIterator = 0; tempIterator < stop; tempIterator++)
|
|
{
|
|
// print out the temp and it's conversion
|
|
printf("%f\t%f\n", );
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// fail program
|
|
printf("Please provide two or three integers.\n");
|
|
return -1;
|
|
}
|
|
// display results
|
|
// done in do calculations
|
|
// return success
|
|
return 0;
|
|
} |