蒂森电梯资料

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

现在写好了,也调试了,自我感觉很好,觉得可以移植到真电梯上去了哦.哈哈.

为了简单,分配了1到9层.另外也没加入有几人同时按,不过那样也不难,再分配10个每层的变量,随机按.再处理,是先向上还是直接向下.不过那倒真的可以用到真的上了.

#include

#include

#include

#define ON 1

#define OFF 0

main(){

int power,i;

char oldkey,key ;

struct date today;

struct time now;

getdate(&today); /*把系统当前日期存入today所指向的date结构中*/

gettime(&now);

gotoxy(25,3);

printf("Today's date is %d-%d-%d\n",today.da_year,today.da_mon,today.da_day); gotoxy(25,6);

printf("Current time is %02d:%02d:%02d\n",now.ti_hour,now.ti_min,now.ti_sec);

if( now.ti_hour>=8||(now.ti_hour<=23&&now.ti_min<59)){

power=ON;

printf("\n\n\nLift power is on.Lift stop in 1 floor.");

}

else {

power=OFF;

printf("Lift power is off.");

}

oldkey=0;

while(power==ON) {

printf("\n\n\nFloor");

for(i=1;i<10;i++)

printf("\n %d",i);

printf("\nPress floor number or q to shut down power :");

if( now.ti_hour>=8||(now.ti_hour<=23&&now.ti_min<59)) power=ON;

else

power=OFF;

key=bioskey(0);

key=key&0x00ff;

system("cls");

if(key=='0'){

power=OFF;

printf("\n\n Lift Power off");

sleep(1);

break;

}

if(key>oldkey)

printf(" %c Go up!...",24);

if(key

printf(" %c Go down!...",25);

if(key==oldkey)

printf(" %c ok you are here",22);

sleep(2);

system("cls");

printf("\n\n ");

switch(key){

case '1':

if(key==oldkey)

printf(" %c ok you are here",22);

else if(key>oldkey)

printf("%c Go up!...stop in %c floor.",24,key);

else

printf("%c Go down!...stop in %c floor.",25,key);

oldkey=key;

break;

case '2':

if(key==oldkey)

printf(" %c ok you are here",22);

else if(key>oldkey)

printf("%c Go up!...stop in %c floor.",24,key); else

printf("%c Go down!...stop in %c floor.",25,key); oldkey=key;

break;

case '3':

if(key==oldkey)

printf(" %c ok you are here",22);

else if(key>oldkey)

printf("%c Go up!...stop in %c floor.",24,key); else

printf("%c Go down!...stop in %c floor.",25,key); oldkey=key;

break;

case '4':

if(key==oldkey)

printf(" %c ok you are here",22);

else if(key>oldkey)

printf("%c Go up!...stop in %c floor.",24,key); else

printf("%c Go down!...stop in %c floor.",25,key); oldkey=key;

break;

case '5':

if(key==oldkey)

printf(" %c ok you are here",22);

else if(key>oldkey)

printf("%c Go up!...stop in %c floor.",24,key); else

printf("%c Go down!...stop in %c floor.",25,key); oldkey=key;

break;

case '6':

if(key==oldkey)

printf(" %c ok you are here",22);

else if(key>oldkey)

相关文档
最新文档