#include <iostream> #include <cstdlib>
using namespace std;
int main ()
{
float a;
char b;
cout << "請輸入溫度(僅需輸入數字與英文字母。範例:32C或50f):";
cin >> a >> b;
if (b == 'c' || 'C')
{
cout << a*(9.0/5)+32 << 'F' << endl;
}
else if (b == 'f' || 'F')
{
cout << (a-32)*(5.0/9) << 'C' << endl;
}
else
cout << "請輸入正確的內容,請重新運行本程式。";
system ("pause");
return 0;
}