You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
623 B
C
34 lines
623 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include "temp.h"
|
|
|
|
float celcius = 0;
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
|
|
if(argc != 2)
|
|
{
|
|
/* We print argv[0] assuming it is the program name */
|
|
printf( "usage: %s requires an integer argument\name", argv[0] );
|
|
return 1;
|
|
}
|
|
else
|
|
{
|
|
printf("Argument: %s\n\n", argv[1]);
|
|
//cast char type to float
|
|
celcius = (float)atof(argv[1]);
|
|
|
|
while (celcius < 110)
|
|
{
|
|
printf("%.2f C = %.2f F = %.2f K\n", celcius,
|
|
celcius_to_fahrenhiet(celcius),
|
|
celcius_to_kelvin(celcius)
|
|
);
|
|
|
|
celcius = celcius + 10;
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
} |