using System;
using System.Data;
using System.Data.OleDb;
namespace convertTempAndMile
{
public class convertTemp
{
private string strFrom;
private string strTo;
private int intTemp;
public convertTemp(string strFromVar, string strToVar, int intTempVar)
{
strFrom = strFromVar;
strTo = strToVar;
intTemp = intTempVar;
}
public double convertTempRun (string strMethod, double intTempVar)
{
double fltConvertOK;
if(strMethod == "H"){
fltConvertOK = intTempVar * 9 / 5 + 32;
} else if(strMethod == "S"){
fltConvertOK = (intTempVar - 32) / 9 * 5;
} else {
fltConvertOK = 0;
}
return fltConvertOK;
}//convertTempRun
public double convertMilesRun (string strMethod, double intMilesVar)
{
double fltConvertOK;
if(strMethod == "Y"){
fltConvertOK = intMilesVar * 1.6039;
} else if(strMethod == "G"){
fltConvertOK = intMilesVar * 0.6214;
} else {
fltConvertOK = 0;
}
return fltConvertOK;
}//convertMilesRun
} //public class convertTemp
}//end namespace
/*
用如下的DOS命令进行编译
set indir=F:/BackUP/wwwroot/aspx/temp.cs
set outdir=F:/BackUP/wwwroot/aspx/temp.dll
csc /t:library /out:%outdir% %indir%
*/