Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
perl circle plot
#perl 5.22.1 my $radius; my $point = '*'; my $noOfPoints = 50; my @plotArea = (); push @plotArea, ["|",(" ") x 70,"|\n"] foreach (0..20); #plot (19*rand(),50*rand(),$_) foreach (0..50); circle(); printAll(); sub plot{ my ($x,$y,$ch)=@_; $plotArea[$x][$y]=$ch; } sub circle{ my $center=[11,35]; my $radius=[10,30]; foreach my $angle (1..50){ plot ($$center[0]+$$radius[0]*sin($angle*6.28/50),$$center[1]-$$radius[1]*cos($angle*6.28/50),$angle); } } sub printAll{ foreach (@plotArea){ print @{$_}; } }
run
|
edit
|
history
|
help
0
perl plot circular list in a circle
101744
testing anonymous routine dereference with alternate syntax
Quotes
Quotes
Sort
Shalu Kumar
roni leonita 101745
objetos
2nd