-
4
pages
-
English
-
Documents
Description
A Brief cT TutorialStart the cT programming environment by double-clicking on the “cT Create” icon. You should see two win-dows side-by-side on your monitor. For now, leave them where they are. (Later on you may find it convenientto resize or reposition them.) The window entitled “cT” is the “execution” window. The display your program generates will appear here.The window entitled “Untitled” is the “edit” window. You will write and edit your cT code here. There isalready one line in this window:$syntaxlevel 2Leave this line alone (it tells the cT compiler what version of cT you are using). Click below this line andtype the following lines. Be sure to put a TAB between each command and its tag:$syntaxlevel 2unit Displayat 10,100disk 4A “unit” is the basic building block of a cT program. The -at- command positions the vir-0,0 10tual pen on a Cartesian coordinate system in which 0,0 is in the upper left-hand corner ofthe screen and the +y axis goes down. The units of distance are pixels. The -disk- com-mand plots a filled circle whose radius is 4 pixels. To run this program, choose “Run frombeginning” from the “Option” menu. You should see a black disk appear in the executionwindow.To animate the disk, we will plot it and erase it repeatedly at different locations. Amendyour current program to include the following code, remembering to type a TAB aftereach command:loopcalc x := x + 1at x,100100disk 4endloopNote that the code ...
-
Publié par
-
Langue
English