moving_on_a_grid

moving_on_a_grid - drawGrid(x y return 0 end of main void...

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

View Full Document Right Arrow Icon
Sheet1 #include <iostream> #include <conio.h> using namespace std void drawGrid(int x, int y) int main() { char userLetter = 's' int x = 0 int y = 0 cout << "X" while (x != ' ') { userLetter = _getch() if (userLetter == 'w') { x-} else if (userLetter == 's') { x++ } else if (userLetter == 'a') { y-} else if (userLetter == 'd') { y++
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
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: } drawGrid(x, y) } return 0 }// end of main void drawGrid(int x, int y) { system(&amp;quot;CLS&amp;quot;) for (int row = 0 { for (int col = 0 { if (row == x &amp;amp;&amp;amp; col == y) { row &amp;lt; 20 col &amp;lt; 20 row++) col++) Page 1 Sheet1 cout &amp;lt;&amp;lt; &amp;quot;X&amp;quot; } else { cout &amp;lt;&amp;lt; &amp;quot; &amp;quot; } } cout &amp;lt;&amp;lt; endl } }// end of drawGrid Page 2...
View Full Document

This note was uploaded on 04/01/2008 for the course CMPSC 101 taught by Professor Drobish,renee during the Spring '07 term at Penn State.

Page1 / 3

moving_on_a_grid - drawGrid(x y return 0 end of main void...

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

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