CyberSlug Rules!

Beginner Programming CMPS060

Prof. Paulo Franca

Home

Syllabus

Login

Objects

Download

Staff only

#include "franca.h"

void drawing(Circle &mycircle,int x,int y,Box &coordx,Box &coordy)

{
// This function draws one frame:
mycircle.place(x,y); // put circle in place
mycircle.show(); // show the circle
coordx.say(x); // write coordinates in boxes
coordy.say(y);
}
void mainprog()
{
// Declaration of objects and variables
Box coordx ("X:"),coordy ("Y:"); // use boxes for x and y
int x,y; // declare coordinates
Circle mycircle; // declare a circle
Clock mytimer; // and a clock
int howmany;
do
{
x=ask("Enter x coordinate:");
y=ask("Enter y coordinate:");
howmany=ask("How many circles?");
for(int k=1;k<=howmany;k++)
{
drawing(mycircle,x,y,coordx,coordy);
mytimer.wait(0.033);
mycircle.erase();
x++;
}
}
while (yesno("Wanna try again?"));
}