Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 09-18-2011, 05:03 AM   #1
Solid State Member
 
Join Date: Feb 2011
Posts: 14
Default Need help with C++ code!!!!!

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
__________________

therockstar920 is offline   Reply With Quote
Old 09-21-2011, 08:21 PM   #2
Baseband Member
 
Join Date: Jun 2005
Posts: 65
Default Re: Need help with C++ code!!!!!

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.
__________________

__________________
All the world's a computer, and all the men and women merely AI agents...
Bucky24 is offline   Reply With Quote
Old 10-07-2011, 01:49 AM   #3
Solid State Member
 
Join Date: Jul 2011
Posts: 8
Default Re: Need help with C++ code!!!!!

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
JhonMichel is offline   Reply With Quote
Old 10-07-2011, 12:24 PM   #4
Baseband Member
 
Join Date: Jun 2005
Posts: 65
Default Re: Need help with C++ code!!!!!

Please create a new topic instead of thread-jacking this one, then PM me the link to it.
__________________
All the world's a computer, and all the men and women merely AI agents...
Bucky24 is offline   Reply With Quote
Old 10-11-2011, 02:35 AM   #5
Solid State Member
 
Join Date: Jul 2011
Posts: 8
Default Re: Need help with C++ code!!!!!

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.
JhonMichel is offline   Reply With Quote
Old 10-11-2011, 02:48 AM   #6
Baseband Member
 
Join Date: Jun 2005
Posts: 65
Default Re: Need help with C++ code!!!!!

As far as I know they are the same thing.
__________________

__________________
All the world's a computer, and all the men and women merely AI agents...
Bucky24 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 07:36 PM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0