14,690,503 members
See more:
*---*---*
-*--*--*-
--*-*-*--
---***---
*********
---***---
--*-*-*--
-*--*--*-
*---*---*

'-' stand for spaces
Posted
Updated 11-Oct-14 7:55am
v2
[no name] 11-Oct-14 12:58pm

Have you at least tried to do your homework assignment yourself?
Member 11146011 11-Oct-14 13:20pm

Im trying just dont know how to do the diagonals :D i have a cross so far
enhzflep 11-Oct-14 13:37pm

I'm assuming so far you have a cross, like this: +
This means you draw a * if x==1/2 of width-1 or if y== 1/2 of height-1.

Let's just look at the top-left corner. Assuming the origin (0,0) is the top left, what do you notice about the relationship of the x and y axis where the *s are printed? Simple - if (x==y) then draw a *. This works for the whole line extending from the top-left to the bottom-right.
A very small modification to this check will tell you when you need to draw a * to do the line from top-right --> bottom-left. :)
Member 11146011 11-Oct-14 13:51pm

Thank you so much. I should`ve thought about that sooner :)
enhzflep 11-Oct-14 14:01pm

No problem. You're welcome. :)

## Solution 1

How about `printf` each line, e.g. for the first two lines:
```printf("*---*---*\n");
printf("-*--*--*-\n");
...```
You say nowhere that you need to calculate anything.
Cheers
Andi
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Top Experts
Last 24hrsThis month
 OriginalGriff 255 Richard Deeming 230 Dave Kreskowiak 100 Richard MacCutchan 79 CPallini 65
 OriginalGriff 4,976 Richard Deeming 2,565 Richard MacCutchan 2,246 CPallini 1,687 Patrice T 1,320

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900