📄
字号:
#include"stdio.h"
#include<reg51.h>
#include"stdlib.h"
#include"math.h"
#include<absacc.h>
#define uint unsigned int
#define uchar unsigned char
#define PORTO XBYTE[0x8003]
#define PORTA XBYTE[0x8000]
#define PORTB XBYTE[0x8001]
#define PORTC XBYTE[0x8002]
#define LEN sizeof(struct yonghu)
struct yonghu
{
uint num;
uint chewei;
uint cunru;
uint quchu;
double mima;
struct yonghu *next;
};
double mima(uint sec,uint min,uint hr,uint num)
{
double mima;
if(hr/10==0) mima=hr*10E9+min*10E6+sec*10E2+num;
else mima=hr*10E8+min*10E6+sec*10E2+num;
return mima;
}
void delay(void)
{
uint i,j;
for(i=0;i<30;i++)
{
for(j=0;j<0xff;j++)
{}
}
}
uint f(void)
{
uint i;
PORTO=0x82;
PORTA=0xfe;
if(!(PORTB&0x01)) i=1;
if(!(PORTB&0x02)) i=2;
if(!(PORTB&0x08)) i=3;
if(!(PORTB&0x0f)) i=10;
PORTA=0xfd;
if(!(PORTB&0x01)) i=4;
if(!(PORTB&0x02)) i=5;
if(!(PORTB&0x08)) i=6;
if(!(PORTB&0x0f)) i=11;
PORTA=0xfb;
if(!(PORTB&0x01)) i=7;
if(!(PORTB&0x02)) i=8;
if(!(PORTB&0x08)) i=9;
if(!(PORTB&0x0f)) i=13;
PORTA=0xf7;
if(!(PORTB&0x01)) i=0;
if(!(PORTB&0x02)) i=12;
if(!(PORTB&0x08)) i=14;
if(!(PORTB&0x0f)) i=15;
return i;
}
main()
{
uint i=0,z=10,j=0,y=0,k=0,feiyong,chewei=0,a,b,c=0,d=0,e=0,sec,min,hr;
double x;
struct yonghu *head1,*p1,*p2,*p3,*p4,*p5,*head=0;
while(1)
{
if(i==10)
{
head1=p2=0;
if(c==0)
{
p1=(struct yonghu*)malloc(LEN);
p1->num=j++;
p1->chewei=0;;
p1->cunru=a;
p1->quchu=b;
p1->mima=x;
p1->next=0;
c=1;
p3=head1=p1;
p2=p1;
}
else
{
for(chewei=0;chewei<10&&p3->next!=0;chewei++,p3=p3->next)
{
if(chewei!=p3->chewei||chewei!=10)
{
e=1;
p1=(struct yonghu*)malloc(LEN);
if(chewei!=p3->chewei)
p1->chewei=chewei;
else p1->chewei=chewei+1;
p1->num=++j;
p1->cunru=a;
p1->quchu=b;
p1->mima=x;
p1->next=0;
p2->next=p1;
p2=p1;
p3=head1;
}
break;
}
if(e==0) for(chewei=19;chewei>=10&&p3->next!=0;chewei--,p3=p3->next)
{
if(chewei!=p3->chewei||chewei!=9)
{
e=1;
p1=(struct yonghu*)malloc(LEN);
if(chewei!=p3->chewei)
p1->chewei=chewei;
else p1->chewei=chewei-1;
p1->num=++j;
p1->cunru=a;
p1->quchu=b;
p1->mima=x;
p1->next=0;
p2->next=p1;
p2=p1;
p3=head1;
}
break;
}
if(e==0) for(chewei=29;chewei>=19&&p3->next!=0;chewei--,p3=p3->next)
{
if(chewei!=p3->chewei||chewei!=18)
{
e=1;
p1=(struct yonghu*)malloc(LEN);
if(chewei!=p3->chewei)
p1->chewei=chewei;
else p1->chewei=chewei-1;
p1->num=++j;
p1->cunru=a;
p1->quchu=b;
p1->mima=x;
p1->next=0;
p2->next=p1;
p2=p1;
p3=head1;
}
break;
}
}
printf("您的用户号为:%d\n",--j);
mima(sec,min,hr,j);
printf("您的密码为:\n");
}
if(i==11)
{
printf("请输入您的用户号:");
for(k=0;k<30;k++)
{
p4=p3;p3=p3->next;
x=p3->num;
for(k=0,z=10,d=0;k<4;x=x/z,k++)
{
uint f(void);
if((x-x/z)!=i)
d=1;
}
if(d==0) break;
if(d==0) printf("请输入您的密码:");
else printf("您输入的用户号不存在,请重试");
x=p3->mima;
for(k=0,z=10,d=0;k<10;x=x/z,k++)
{
uint f(void);
if((x-x/z)!=i) d=1;
}
if(d==0)
{
printf("请您取车");
for(k=0;k<30;k++)
{
if(head==0)
if(head1==p3) {head=p3;p5=p3;head1=head1->next;return head1;}
else {head=p3;p5=p3;p4->next=p3->next;}
else
if(head1==p3) {}
}
}
else printf("您输入的密码有误,请重试");
}
if(i==12)
{
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -