|
if(F_440_452&&wrh_1==0)
{
wrh_1=1;
first_1=time(NULL);
time(&tt);
wrh1=ctime(&tt);
}
if(J_452_440&&wrh_1==1)
{
wrh_1=2;
second_1=time(NULL);
time(&tt);
rh1=ctime(&tt);
if(second_1>first_1&&wrh_1==2)
{ wrh_1=0;
time(&tt);
v440_452=s440_452/difftime(second_1,first_1)*36/10;
if((40<v440_452)||(v440_452<5))
{
myf<<"火车开出时间:"<<wrh1<<endl;
myf<<"火车到达时间:"<<rh1<<endl;
myf<<"火车平均时速:"<<v440_452<<"Km/h"<<endl<<endl;
Canvas->Font->Color=clRed;
Canvas->TextOut(500,80,"V = "+IntToStr(v440_452)+" kM/h");
}
else if(v440_452>5&&v440_452<40)
{
Canvas->Font->Color=clWhite;
Canvas->TextOut(500,80,"V = "+IntToStr(v440_452)+" kM/h");
}
}
}
这里的char *wrh1;
char *rh1;所有的变量都是全局变量。
我的问题是wrh1,rh1写在这里为什么值都是一样的,是当前时间值,而不是它在条件成立时的时间值呢 |
|