C++ 问题 请大神帮忙
这是我写的程序和我打印出来的结果#include <iostream>
#include<iomanip>
using namespace std;
doublecelsiusToFahrenheit(double celsius)
{doubleFahrenheit;
Fahrenheit=(9.0/5)*celsius+32;
return Fahrenheit;
}
doublefahrenheitToCelsius(double Fahrenheit)
{doublecelsius;
celsius=(5.0/9)*(Fahrenheit-32);
return celsius;
}
int main()
{
double a,Fahrenheit,c,Celsius;
cout<<" Zoe's char - converting Celsius Temperatures to Fahrenheit"<<endl;
cout<<"----------------------------------------------------------------------"<<endl;
cout<<" Celsius Fahrenheit| Fahrenheit Celsius " <<endl;
cout<<"----------------------------------------------------------------------"<<endl;
for(a=40.0,c=120.0;a>30.0&&c>20.0;a--,c=c-10)
{
Fahrenheit = celsiusToFahrenheit(a);
Celsius = fahrenheitToCelsius(c);
cout<<setw(8)<<fixed<<setprecision(1)<<a
<<setw(12)<<Fahrenheit<<setw(9)<<"|"
<<setw(9)<<fixed<<setprecision(1)<<c
<<setw(20)<<fixed<<setprecision(2)<<Celsius<<setw(11)<<endl;
}
return 0;
}
预期结果:
顶一个:lol: 挺复杂的啊,这是提问还是自己秀程序?
页:
[1]