string Get_Star;
int s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12;
int Tp_Time;
Tp_Time = Convert.ToInt32 (StarTimes);
s1=321;
s2=420;
s3=521;
s4=621;
s5=723;
s6=823;
s7=923;
s8=1023;
s9=1122;
s10=1222;
s11=120;
s12=219; if( Tp_Time - s1 >=0 && s2 - Tp_Time <=99 && s2 - Tp_Time >= 0)
{
return "白羊";
}
else if(Tp_Time - s2 >=0 && s3 - Tp_Time <=101 && s3 - Tp_Time >= 0)
{
return "金牛";
}
.......如何??这个办法好妈???
int s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12;
int Tp_Time;
Tp_Time = Convert.ToInt32 (StarTimes);
s1=321;
s2=420;
s3=521;
s4=621;
s5=723;
s6=823;
s7=923;
s8=1023;
s9=1122;
s10=1222;
s11=120;
s12=219; if( Tp_Time - s1 >=0 && s2 - Tp_Time <=99 && s2 - Tp_Time >= 0)
{
return "白羊";
}
else if(Tp_Time - s2 >=0 && s3 - Tp_Time <=101 && s3 - Tp_Time >= 0)
{
return "金牛";
}
.......如何??这个办法好妈???
解决方案 »
- TabControl控件的分页可以消隐吗?
- 弹出对话框显示数据,不弹出不显示
- 根据DropDownList的值的改变而改变textbox的值
- 如何把windows窗体状态栏的进度条移动到中间?
- c# 自定义dll后,引用dll文件时的命名空间问题
- 在windows服务里面如何同时启动两个线程
- 一个winform程序给个人用户使用,请问使用什么数据库比较合适?
- 100分,路过的大侠出招!怎么用程序验证安装包文件的数字签名有效?
- 各位大侠帮帮忙,怎么设置listbox中的某条item的高度!
- DATAGRID处于编辑状态时的取值问题,
- C#中自动生成SQL语句(update,delete)是否并不怎么好呢?
- 请教:关于DataGrid的数据绑定
如果有规律的话,就可以用算法了。
{ /// <summary>
/// 返回值,需要初始化
/// </summary>
public readonly static string[] sStars; //["白羊"] /// <summary>
/// 比较值(星座起始日),需要初始化
/// </summary>
public readonly static string[] sStarDates;//["0122",]
/// <summary>
/// 建构、初始化
/// </summary>
static StarProcess()
{
sStars = new string[]{"白羊"/*....*/};
sStarDates = new string[]{"0122"/*....*/};
} /// <summary>
/// 根据生日取得星座
/// </summary>
/// <param name="sBir"></param>
/// <returns></returns>
public static string GetStar(string sBir)
{
for(int i = 0 ; i< 12; i++ )
{
if(sBir < sStarDates[i])
return sStars[i];
}
}