level 4
浅浅久久333
楼主
#include<iostream>
#include<cmath>
#include<cstdlib>
#include <graphics.h>
#include <conio.h>
#include<time.h>
#include<stdio.h>
#include<math.h>
void main()
{ initgraph(5000, 5000); srand((int)time(0));
int j,n,x,y;
int aj_x,aj_y,bj_x,bj_y,cj_x,cj_y;
int d1,d2,d3;int r = rand() % 500+ 300;
char s[10],a1[20],b1[20],c1[20],a2[20],b2[20],c2[20],m[10];
sprintf(s, "%d", r);
setaspectratio(0.25,0.25);
outtextxy(3770,1910,s);
setaspectratio(0.25,0.25);
for(x=700;x<=4100;x=x+r)
for(y=1300;y<=1800;y=y++)
putpixel(x,y,YELLOW);
setaspectratio(0.25,0.25);
rectangle(800,1645,r,1540);
setlinecolor(GREEN);
setlinestyle(PS_DASHDOT,NULL,5);
rectangle(700,1465,4100,1675);
int max=3200/r+1;
sprintf(m, "%d", max);
outtextxy(3770,2000,m);
{for(j=0;j<=max;n=800+j*r,j++)
{do{srand(time(NULL));
aj_x=rand()%r+n;
bj_x=rand()%r+n;
cj_x=rand()%r+n;
aj_y=rand()%75+1465;
bj_y=rand()%75+1465;
cj_y=rand()%75+1465;
d1=sqrt((aj_x-bj_x)^2+(aj_y-bj_y)^2);
d2=sqrt((aj_x-cj_x)^2+(aj_y-cj_y)^2);
d3=sqrt((bj_x-cj_x)^2+(bj_y-cj_y)^2);}
while(d1<=50||d2<=50||d3<=50);
putpixel(aj_x,aj_y,RED);
putpixel(bj_x,bj_y,RED);
putpixel(cj_x,cj_y,RED);
sprintf(a1,"%d",aj_x);
sprintf(a2,"%d",aj_y);
sprintf(b1,"%d",bj_x);
sprintf(b2,"%d",bj_y);
sprintf(c1,"%d",cj_x);
sprintf(c2,"%d",cj_y);
outtextxy(200,200,a1);
outtextxy(400,200,a2);
outtextxy(200,200*j,b1);
outtextxy(400,200*j,b2);
outtextxy(200,200*(j+1),c1);
outtextxy(400,200*(j+1),c2);}}
getch();
closegraph();}
2013年04月11日 02点04分
1
#include<cmath>
#include<cstdlib>
#include <graphics.h>
#include <conio.h>
#include<time.h>
#include<stdio.h>
#include<math.h>
void main()
{ initgraph(5000, 5000); srand((int)time(0));
int j,n,x,y;
int aj_x,aj_y,bj_x,bj_y,cj_x,cj_y;
int d1,d2,d3;int r = rand() % 500+ 300;
char s[10],a1[20],b1[20],c1[20],a2[20],b2[20],c2[20],m[10];
sprintf(s, "%d", r);
setaspectratio(0.25,0.25);
outtextxy(3770,1910,s);
setaspectratio(0.25,0.25);
for(x=700;x<=4100;x=x+r)
for(y=1300;y<=1800;y=y++)
putpixel(x,y,YELLOW);
setaspectratio(0.25,0.25);
rectangle(800,1645,r,1540);
setlinecolor(GREEN);
setlinestyle(PS_DASHDOT,NULL,5);
rectangle(700,1465,4100,1675);
int max=3200/r+1;
sprintf(m, "%d", max);
outtextxy(3770,2000,m);
{for(j=0;j<=max;n=800+j*r,j++)
{do{srand(time(NULL));
aj_x=rand()%r+n;
bj_x=rand()%r+n;
cj_x=rand()%r+n;
aj_y=rand()%75+1465;
bj_y=rand()%75+1465;
cj_y=rand()%75+1465;
d1=sqrt((aj_x-bj_x)^2+(aj_y-bj_y)^2);
d2=sqrt((aj_x-cj_x)^2+(aj_y-cj_y)^2);
d3=sqrt((bj_x-cj_x)^2+(bj_y-cj_y)^2);}
while(d1<=50||d2<=50||d3<=50);
putpixel(aj_x,aj_y,RED);
putpixel(bj_x,bj_y,RED);
putpixel(cj_x,cj_y,RED);
sprintf(a1,"%d",aj_x);
sprintf(a2,"%d",aj_y);
sprintf(b1,"%d",bj_x);
sprintf(b2,"%d",bj_y);
sprintf(c1,"%d",cj_x);
sprintf(c2,"%d",cj_y);
outtextxy(200,200,a1);
outtextxy(400,200,a2);
outtextxy(200,200*j,b1);
outtextxy(400,200*j,b2);
outtextxy(200,200*(j+1),c1);
outtextxy(400,200*(j+1),c2);}}
getch();
closegraph();}