# HELP!!!!!!! TROUBLE BEGGINING LAB ON REPETITION AND LOOPING

• ### Question

• Can someone please help me on this lab thats due tonight, i have no idea how to start it and im about to pull my hair out

Write a program that draws a rectangle, square or any other number sided shape based on user input.  Prompt the user for the number of sides and the length of a side.  Using that create a loop that draws the sides and turns based on the number of sides requested.

Wednesday, March 25, 2015 3:02 AM

• As much as I loath the idea of doing your homework for you.... Here is the Small Basic version:

```top:
TextWindow.Write("Number of sides: ")
GraphicsWindow.Show()
Turtle.Show()
Turtle.Speed = 10

For i = 1 To numSides
Turtle.Move(100)
Turtle.Turn(360/numSides)
EndFor
Goto top```

Wednesday, March 25, 2015 5:42 PM
• Coding Cat, yeah, let's not do their homework for them. Maybe instead show them where they could specifically learn more about the Turtle and TextWindow objects. We have curriculum, tutorials, getting started, Reference Docs, and more... all on the Wiki and free.

Etria, you can just search for "TechNet Wiki Small Basic" and then any topic you want. You'll get lots of options. So please do this for your other Small Basic assignments.

What country, state, and grade is this in? Just curious where and to whom (what grade) these classes are taking place in.

Thanks!

Ed Price, Azure & Power BI Customer Program Manager (Blog, Small Basic, Wiki Ninjas, Wiki)

Saturday, March 28, 2015 10:39 PM

### All replies

``` private static void Main(string[] args)
{

Turtle.Speed = 8;
Console.WriteLine("What do you want to draw ?");
Console.WriteLine("For Square input 1");
Console.WriteLine("For Rectangle input 2,");
Console.WriteLine("For Triangle input 3");
Console.WriteLine("For Pentagon input 4");
Console.WriteLine("For Hexagon imput 5");
switch (shapeType)
{
case 1:
Console.WriteLine("Input side length");
for (int i = 1; i < 5; i++)
{
Turtle.Move(sidelength1);
Turtle.Turn(90);
}

break;
case 2:
Console.WriteLine("Input first side length");
Console.WriteLine("Input second side length");
for (int i = 1; i < 3; i++)
{
Turtle.Move(sidelength2);
Turtle.Turn(90);
Turtle.Move(sidelength22);
Turtle.Turn(90);
}

break;
case 3:
Console.WriteLine("Input side length");
for (int i = 1; i < 4; i++)
{
Turtle.Move(sidelength3);
Turtle.Turn(120);
}
break;
case 4:
Console.WriteLine("Input side length");
for (int i = 1; i < 6; i++)
{
Turtle.Move(sidelength4);
Turtle.Turn(72);
}
break;
case 5:
Console.WriteLine("Input side length");
for (int i = 1; i < 7; i++)
{
Turtle.Move(sidelength5);
Turtle.Turn(60);
}
break;

default:
Console.WriteLine("Bye Bye Bye Bye");
break;

}```

Wednesday, March 25, 2015 7:13 AM
• Hi,

To start I recommend you to visit the Small Basic Portal : http://social.technet.microsoft.com/wiki/contents/articles/17553.wiki-small-basic-portal.aspx

You will find lot of resource to get started with Small Basic, in particular the get started guide : http://social.technet.microsoft.com/wiki/contents/articles/16059.small-basic-getting-started-guide.aspx

wich contains the basis to programming, using graphics, and more.

Have fun,

Yan Grenier

Merci de bien vouloir "Marquer comme réponse", les réponses qui ont répondues à votre question, et de noter les réponses que vous avez trouvé utiles.

Wednesday, March 25, 2015 7:15 AM
• As much as I loath the idea of doing your homework for you.... Here is the Small Basic version:

```top:
TextWindow.Write("Number of sides: ")
GraphicsWindow.Show()
Turtle.Show()
Turtle.Speed = 10

For i = 1 To numSides
Turtle.Move(100)
Turtle.Turn(360/numSides)
EndFor
Goto top```

Wednesday, March 25, 2015 5:42 PM
• Azat, what was that? =^)

This is the Small Basic forum!

Ed Price, Azure & Power BI Customer Program Manager (Blog, Small Basic, Wiki Ninjas, Wiki)

Saturday, March 28, 2015 10:34 PM
• Coding Cat, yeah, let's not do their homework for them. Maybe instead show them where they could specifically learn more about the Turtle and TextWindow objects. We have curriculum, tutorials, getting started, Reference Docs, and more... all on the Wiki and free.

Etria, you can just search for "TechNet Wiki Small Basic" and then any topic you want. You'll get lots of options. So please do this for your other Small Basic assignments.

What country, state, and grade is this in? Just curious where and to whom (what grade) these classes are taking place in.

Thanks!

Ed Price, Azure & Power BI Customer Program Manager (Blog, Small Basic, Wiki Ninjas, Wiki)