Complete HW3

++ Programs
+- C Files
This commit is contained in:
Charles Descamps 2023-11-05 13:43:22 -07:00
parent aae5754baa
commit 42fc64e613
4 changed files with 44 additions and 27 deletions

View file

@ -19,35 +19,26 @@ Dependencies: included by standard libraries
*/
int main(int argc, char *argv[])
{
// define local variables
double start = atof(argv[1]), stop = atof(argv[2]);
// check if proper arguments are provided
if (argc < 3 || argc > 4)
{
printf("You must provide two or three integers.\n");
return 0;
}
// define the start and stops, steps if applicable
double start = atof(argv[1]);
double stop = atof(argv[2]);
int step = 1;
int tempIterator;
// do calculations
if(argc == 3 || argc == 2)
if (argc == 4)
{
// 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", );
}
// define the step if provided.
step = atoi(argv[3]);
}
else
for (start = atof(argv[1]); start <= stop; start += step)
{
// fail program
printf("Please provide two or three integers.\n");
return -1;
// print out the temperature chart
printf("%g\t%f\n", start, (start - 32) * 5 / 9);
}
// display results
// done in do calculations
// return success
// end program
return 0;
}