Uses GraphABC; procedure Draw(x, y, l, u : Real; t : Integer);
procedure Draw2(Var x, y: Real; l, u : Real; t : Integer); begin Draw(x, y, l, u, t); x := x + l*cos(u); y := y - l*sin(u);end; begin if t > 0 then beginl := l/3;Draw2(x, y, l, u, t-1);Draw2(x, y, l, u+pi/3, t-1); Draw2(x, y, l, u-pi/3, t-1);Draw2(x, y, l, u, t-1);end else Line(Round(x), Round(y), Round(x+cos(u)*l), Round(y-sin(u)*l))end; begin SetWindowSize(425,500); SetWindowCaption('Фракталы: Снежинка Коха'); Draw(10, 354, 400, pi/3, 4);Draw(410, 354, 400, pi, 4); Draw(210, 8, 400, -pi/3, 4);end.
#include <stdio.h>#include <time.h> int main(void) { int left, right, num = 5; time_t t;
scanf ("%d %d", &left, &right);
if(left >= right) { fprintf(stderr, "min_num is greater or equal than max_num!\n"); }
printf ("left = %d right = %d \n", left, right); /* Intializes random number generator */ srand((unsigned) time(&t)); /* Print num random numbers from left to right */ while (num > 0) { printf ( "%d ", left + (rand() % (right + 1 - left)) ); num--; } return 0;}
0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota
Оформи подписку