#include<ctype.h>
#include<graphics.h>
#include<stdlib.h>
#include<math.h>
#include<conio.h>
#define X 800 //图形区域宽度
#define Y 600 //图形区域高度
#define WD 100 //单向车道宽度
#define LR 100 //车道长度
#define R 10 //红绿灯半径
void drawroad()
void pSound()
void baoshi()
void main(){
initgraph(X,Y)
setbkcolor(LIGHTGRAY)
cleardevice()
drawroad()
getch()
closegraph()
}
void drawroad(){
int midx=X/2,midy=Y/2,i
setlinecolor(YELLOW)
setlinestyle(PS_DASH,2)
moveto(midx-WD/2,midy-WD-100)
lineto(midx-WD/2,0)
moveto(midx+WD/2,midy-WD-100)
lineto(midx+WD/2,0)
moveto(midx-WD/2,midy+WD+100)
lineto(midx-WD/2,Y)
moveto(midx+WD/2,midy+WD+100)
lineto(midx+WD/2,Y)
moveto(midx-WD-100,midy-WD/2)
lineto(0,midy-WD/2)
moveto(midx-WD-100,midy+WD/2)
lineto(0,midy+WD/2)
moveto(midx+WD+100,midy-WD/2)
lineto(X,midy-WD/2)
moveto(midx+WD+100,midy+WD/2)
lineto(X,midy+WD/2)
setlinestyle(PS_SOLID,3)
moveto(midx-WD,midy-WD-100)
lineto(midx-WD,0)
moveto(midx+WD,midy-WD-100)
lineto(midx+WD,0)
moveto(midx-WD,midy-WD-100)
linerel(2*WD,0)
for(i=0i<25i++)
line(midx-WD+(i-2)*10,midy-WD-100+10,midx-WD+(i-2)*10,midy-WD-100+40)
moveto(midx-WD,midy+WD+100)
lineto(midx-WD,Y)
moveto(midx+WD,midy+WD+100)
lineto(midx+WD,Y)
moveto(midx-WD,midy+WD+100)
linerel(2*WD,0)
for(i=0i<25i++)
line(midx-WD+(i-2)*10,midy+WD+100-10,midx-WD+(i-2)*10,midy+WD+100-40)
moveto(midx-WD-100,midy-WD)
lineto(0,midy-WD)
moveto(midx-WD-100,midy+WD)
lineto(0,midy+WD)
moveto(midx-WD-100,midy-WD)
linerel(0,2*WD)
for(i=0i<25i++)
line(midx-WD-100+10,midy-WD+(i-2)*10,midx-WD-100+40,midy-WD+(i-2)*10)
moveto(midx+WD+100,midy-WD)
lineto(X,midy-WD)
moveto(midx+WD+100,midy+WD)
lineto(X,midy+WD)
moveto(midx+WD+100,midy-WD)
linerel(0,2*WD)
for(i=0i<25i++)
line(midx+WD+100-10,midy-WD+(i-2)*10,midx+WD+100-40,midy-WD+(i-2)*10)
setfillstyle(BS_HATCHED,HS_BDIAGONAL)
fil
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)