3 Replies - 2076 Views - Last Post: 30 October 2009 - 07:46 PM Rate Topic: -----

#1 riteousninja  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 29-October 09

How to make a function that draws a square

Posted 30 October 2009 - 06:50 PM

Hello im having a big problem where i cant figure out how to get a function of mine to draw a square. Were supposed to have two inputs. One is height, the other is brush. I need help on being able to code a function that does this.

The function takes these two inputs:
1. a character to be used to draw the selected shape
2. The height (in lines on the screen) of the shapes to draw

After you imput those the function would bring up a square that is drawn with say, a @ sign and is 5 @ signs on the sides, and top in bottom. a sample output would be this

@@@@@
@------@
@------@
@------@
@------@
@@@@@
(with the dashes not being dashes but spaces)
need help asap. thanks

This post has been edited by riteousninja: 30 October 2009 - 06:52 PM


Is This A Good Question/Topic? 0
  • +

Replies To: How to make a function that draws a square

#2 cvitullo  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 14
  • Joined: 02-April 09

Re: How to make a function that draws a square

Posted 30 October 2009 - 07:26 PM

What do you have so far? This is a help site, not a do-it-for-you site.
Was This Post Helpful? 0
  • +
  • -

#3 jjl  Icon User is offline

  • Engineer
  • member icon

Reputation: 1072
  • View blog
  • Posts: 4,532
  • Joined: 09-June 09

Re: How to make a function that draws a square

Posted 30 October 2009 - 07:38 PM

hint hint - loop
Was This Post Helpful? 0
  • +
  • -

#4 Dogstopper  Icon User is offline

  • The Ninjaducky
  • member icon



Reputation: 2870
  • View blog
  • Posts: 11,021
  • Joined: 15-July 08

Re: How to make a function that draws a square

Posted 30 October 2009 - 07:46 PM

try to use a for loop.

for(int i = 0; i < input; i++)
{
	// Do the printing here
}



I will reiterate, this IS a help site, so you will have to show some code.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1