#include
const a=1.80,b=32.00,c=273.16;
void temperateure(double n);
int main(void)
{
double fahrenheit,celsius,kelvin;
printf("input fahrenheit.q or no number letter to quit\n");
scanf("%f",&fahrenheit);
while(scanf("%f",&fahrenheit)==1)
{
temperature(fahrenheit);
printf("%.2f.\n %.2f.\n %.2f.\n",fahrenheit,celsius,kelvin);
scanf("%f",&fahrenheit);
}
printf("wrong\n");
return 0;
}
void temperateure(double fahrenheit)
{
celsius=a*fahrenheit+b;
kelvin=celsius+c;
return 0;
}

1个回答

const a=1.80,b=32.00,c=273.16;
->
const double a=1.80,b=32.00,c=273.16;

void temperateure(double n);
->
void temperature(double n);

``````#include<stdio.h>
const double a=1.80,b=32.00,c=273.16;
void temperature(double fahrenheit, double & celsius, double & kelvin);
int main(void)
{
double fahrenheit,celsius,kelvin;
printf("input fahrenheit.q or no number letter to quit\n");
scanf("%f",&fahrenheit);
while(scanf("%f",&fahrenheit)==1)
{
temperature(fahrenheit,celsius,kelvin);
printf("%.2f.\n %.2f.\n %.2f.\n",fahrenheit,celsius,kelvin);
scanf("%f",&fahrenheit);
}
printf("wrong\n");
return 0;
}
void temperature(double fahrenheit, double & celsius, double & kelvin)
{
celsius=a*fahrenheit+b;
kelvin=celsius+c;
}
``````