solutions12 - create canvas Pen p(c create pen loop to draw...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CSCI-1100 Computer Science I Rensselaer Polytechnic Institute Spring 2004 Studio 12 -- Solutions 1. a) p.Move(count*4); p.Turn(90); 1. b) p.Move(count); p.Turn(45); 1. c) p.Move(15); p.Turn(10); 2. #include "Canvas.h" #include "Pen.h" int main () //PURPOSE: draw a row of six boxes //PRECONDITIONS: none //POSTCONDITIONS: return 0 if successful { int rows; // count rows of squares int ss; //count square sides int num; //count number of squares Canvas c(610,450,0,0);
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: // create canvas Pen p(c); // create pen // loop to draw four rows of boxes for (rows = 0; rows <= 3; rows = rows+1) { // loop to draw six boxes for (num=0; num<=5; num=num+1) { // position pen to draw box p.GoTo(num*100, rows*100+10); // loop to draw one box for (ss = 1; ss <= 4; ss = ss + 1) { p.Move(100); p.Turn(-90); }; }; }; // wait to delete window c.runUntilEscape(); return 0; }...
View Full Document

This homework help was uploaded on 04/16/2008 for the course CSCI 1100 taught by Professor Hardwick during the Fall '08 term at Rensselaer Polytechnic Institute.

Page1 / 2

solutions12 - create canvas Pen p(c create pen loop to draw...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online