Started Homework 3
++ Fibonacci ++ Jump the Five ++ Temperature Chart
This commit is contained in:
parent
e68af45401
commit
aae5754baa
4 changed files with 135 additions and 0 deletions
53
Homework3/temperature_chart.c
Normal file
53
Homework3/temperature_chart.c
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
// 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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue