hello~
Write a program that will display a pattern depending on n. Assume n as a one digit odd number.
Example: if n=9, display
*000*000*
0*00*00*0
00*0*0*00
000***000
how will i start doing this type of problem? ^^
hello~
Write a program that will display a pattern depending on n. Assume n as a one digit odd number.
Example: if n=9, display
*000*000*
0*00*00*0
00*0*0*00
000***000
how will i start doing this type of problem? ^^
Start by making a subset of the pattern:
*0000000*
0*00000*0
00*000*00
000*0*000
This is easier to visualize with two counters to mark the stars. After you get this one, you can add the central star that does not ever move.
can you show me the codes? ^^
No. This is a simple homework problem, and Daniweb's homework policy is not to give code examples without proof of effort.
No. This is a simple homework problem, and Daniweb's homework policy is not to give code examples without proof of effort.
ok! got it~
:twisted:
:D
Have a left, middle, and end variable. Make middle static.
Move left up 1, move end down 1. If left == mid || right == mid then stop.
Move left up 1, move end down 1. If left == mid || right == mid then stop.
You can also do away with the middle variable because that case is identical to when left == right
.
Have a left, middle, and end variable. Make middle static.
Move left up 1, move end down 1. If left == mid || right == mid then stop.
is that possible to create in each line?
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.