#include <ctype.h>
#include <stdlib.h>
double Temperature(double Fahrenheit)
{
return 1.8 * Fahrenheit + 32.0;
}
void main()
{
char s[20];
int i = 0;
while(s[i++] = getchar())
{
if (!isdigit(s[i - 1]) && s[i - 1] != '\n')
{
break;
}
if (s[i - 1] == '\n')
{
printf("攝氏度為: %f\n", Temperature(atof(s)));
i = 0;
}
}
}
剛寫好的...手動辛苦碼啊...