Grid: | ||
Tics Lines: |
|
Width
px
|
Hash Lines: |
|
Width
px
|
Labels: |
|
Font
px
|
Trace Lines: | ||
Robot 1: |
|
Width
px
|
Robot 2: |
|
Width
px
|
Robot 3: |
|
Width
px
|
Robot 4: |
|
Width
px
|
Axes: | x-axis | y-axis | Show Grid |
Grid: | 24x24 inches | 36x36 inches | 72x72 inches |
96x96 inches | 192x192 inches | ||
Quad: | 4 quadrants | 1 quadrant | Hardware |
Units: | US Customary | Metric |
Background: |
![]() |
|
|
|
|
|
|
|
|
|
/* Code generated by RoboBlockly v2.0 */ /* Problem Statement: The program animates a random number of cars passing. Click run and count how many cars pass and input the number when prompted.*/ #include <chplot.h> CPlot plot; int count; // Describe this function... void start() { double randomnum; double d; randomnum = 5; count = 0; while(count < randomnum) { for(d = -12; d <= 12; d += 0.6) { //plot.backgroundImage("rainbow.png"); plot.noStrokeColor(); plot.fillColor("#33cc00"); plot.rectangle(-12, -12, 24, 11); plot.fillColor("#999999"); plot.rectangle(-12, -9, 24, 6); plot.strokeColor("white"); plot.strokeWidth(4); plot.line(-12, -6, 12, -6); plot.noStrokeColor(); plot.strokeWidth(2); plot.fillColor("cyan"); plot.rectangle(d, -7, 7, 3); plot.fillColor("#3333ff"); plot.circle(d + 2, -7, 1); plot.circle(d + 5, -7, 1); delaySeconds(0.03); } count = count + 1; } } randint(2, 10); // sample solution printf("Please count the number of cars passed by."); start(); printf("There should be 5"); plot.label(PLOT_AXIS_XY, ""); plot.grid(PLOT_OFF); plot.tics(PLOT_AXIS_XY, PLOT_OFF); plot.axis(PLOT_AXIS_XY, PLOT_OFF); plot.axisRange(PLOT_AXIS_XY, -12, 12); plot.ticsRange(PLOT_AXIS_XY, 2); plot.sizeRatio(1); plot.plotting();
Problem Statement: The program animates a random number of cars passing. Click run and count how many cars pass and input the number when prompted. |
|||||||||||
|
|||||||||||