Need help with C++ code!!!!!

therockstar920

Solid State Member
Messages
14
I want to print a pattern in which pattern moves in clockwise direction.

21 22 23 24 25
20 7 8 9 10
19 6 1 2 11
18 5 4 3 12
17 16 15 14 13

Plz help
 
The best way to accomplish this is to first generate a 2D array (which would be 5x5 for your example). Then run a loop similar to the following:

set start position in array
for n = 25 to 1
set array element at position to n
move postion
if moved position is off the array (you hit an edge) or it already has a number
unmove position
change direction
move position
endif
endfor

print array

Could use a little refinement (the logic is kinda ugly), but should get the job done.
 
Hi, Bucky24
I need your help if you don't mind.
I need to know how can I get the code of alphabetic keys and numeric key.
and also print them with digit or number.
thanks
 
Please create a new topic instead of thread-jacking this one, then PM me the link to it.
 
Hi, Bucky24
Very nice to again.
Forget the last one,, just tell me the difference between Turbo C and Bore land C.
Both are used for same purpose.
 
Back
Top Bottom