Click here to Skip to main content
15,882,464 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:

'-' stand for spaces
Updated 11-Oct-14 6:55am
[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. :)

1 solution

How about printf each line, e.g. for the first two lines:
You say nowhere that you need to calculate anything.
Share this answer

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

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