2012年12月7日 星期五

c++之華氏換攝氏


#include<iostream>
#include<cstdlib>
using namespace std;
float temperature(float x)
{
return   x=(x-32)*5/9;
}
int main()
{
float x,y;
cout<<"請輸入華氏溫度" <<endl;
cin>>x;
y=temperature(x);
cout<<"攝氏溫度為"<<y<<endl;
}

沒有留言:

張貼留言