Click here to Skip to main content
15,918,243 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
GeneralRe: VC++ 6.0 & .NET 2003 Pin
Christian Graus20-Oct-05 9:47
protectorChristian Graus20-Oct-05 9:47 
QuestionWrite/read Windows registry? Pin
Lord Kixdemp14-Oct-05 14:35
Lord Kixdemp14-Oct-05 14:35 
AnswerRe: Write/read Windows registry? Pin
RFOG15-Oct-05 1:03
RFOG15-Oct-05 1:03 
GeneralRe: Write/read Windows registry? Pin
Lord Kixdemp15-Oct-05 6:28
Lord Kixdemp15-Oct-05 6:28 
Questionvariables Pin
Anonymous14-Oct-05 11:28
Anonymous14-Oct-05 11:28 
AnswerRe: variables Pin
khan++14-Oct-05 21:25
khan++14-Oct-05 21:25 
QuestionC/C++ Code needed Pin
CMentor14-Oct-05 8:41
CMentor14-Oct-05 8:41 
AnswerRe: C/C++ Code needed Pin
akcom14-Oct-05 10:03
akcom14-Oct-05 10:03 
I doubt this is even remotely optimized, but here is a qad solution:
#define UP (UCHAR)0
#define DOWN (UCHAR)1
#define LEFT (UCHAR)2
#define RIGHT (UCHAR)3

UCHAR **Matrix( UCHAR n )
{
UCHAR **Result = new UCHAR *[n];
for ( UCHAR i = 0; i < n ; i++ )
{
Result[i] = new UCHAR[n];
memset( Result[i], 0, sizeof(UCHAR)*n );
}

UCHAR r, c;
UCHAR Dir;
UCHAR cc;

r = 0;
c = 0;
i = 1;

Dir = RIGHT;
while ( true )
{
cc = Result[c][r];
if ( cc != 0 )
{
if ( Dir == RIGHT )
{
if ( Result[c-1][r+1] == 0 )
{
Dir = DOWN;
c--;
r++;
}
else
{
break;
}
}
else
if ( Dir == DOWN )
{
if ( Result[c-1][r-1] == 0 )
{
Dir = LEFT;
c--;
r--;
}
else
{
break;
}
}
else
if ( Dir == LEFT )
{
if ( Result[c+1][r-1] == 0 )
{
Dir = UP;
r--;
c++;
}
else
{
break;
}
}
else
if ( Dir == UP )
{
if ( Result[c+1][r+1] == 0 )
{
Dir = RIGHT;
c++;
r++;
}
else
{
break;
}
}
}
Result[c][r] = i;

switch ( Dir )
{
case RIGHT:
if ( c == n - 1 )
{
r++;
Dir = DOWN;
}
else
{
c++;
}
break;

case DOWN:
if ( r == n - 1 )
{
c--;
Dir = LEFT;
}
else
{
r++;
}
break;

case LEFT:
if ( c == 0 )
{
r--;
Dir = UP;
}
else
{
c--;
}
break;

case UP:
if ( r == 0 )
{
c++;
Dir = RIGHT;
}
else
{
r--;
}
break;
}
i++;
}

for ( r = 0; r < n; r++ )
{
for ( c = 0; c < n; c++ )
{
printf( "%3u ", Result[c][r] );
}
printf( "\n" );
}

return Result;
}

int main(int argc, char* argv[])
{
Matrix( 5 );
return 0;
}
viola.
GeneralRe: C/C++ Code needed Pin
toxcct17-Oct-05 2:13
toxcct17-Oct-05 2:13 
QuestionWhy can't I write a code like this ?? Pin
ComplexLifeForm13-Oct-05 23:22
ComplexLifeForm13-Oct-05 23:22 
AnswerRe: Why can't I write a code like this ?? Pin
Nemanja Trifunovic14-Oct-05 6:07
Nemanja Trifunovic14-Oct-05 6:07 
GeneralRe: Why can't I write a code like this ?? Pin
ComplexLifeForm16-Oct-05 17:19
ComplexLifeForm16-Oct-05 17:19 
Questionhelp: how to write 32 bits to 4 byte aligned address? Pin
Rostfrei13-Oct-05 21:48
Rostfrei13-Oct-05 21:48 
AnswerRe: help: how to write 32 bits to 4 byte aligned address? Pin
Joey Bloggs19-Oct-05 19:31
Joey Bloggs19-Oct-05 19:31 
QuestionSoftware Agent with VB.Net Pin
Banisha12-Oct-05 22:33
Banisha12-Oct-05 22:33 
QuestionHow to know the TCP command end? Pin
rushing12-Oct-05 20:46
rushing12-Oct-05 20:46 
AnswerRe: How to know the TCP command end? Pin
Daniel Grunwald13-Oct-05 9:46
Daniel Grunwald13-Oct-05 9:46 
QuestionHow to Detect Lan Cable Connectivity Pin
Girish60112-Oct-05 20:45
Girish60112-Oct-05 20:45 
QuestionCompile error with wininet.h Pin
brwoodru12-Oct-05 6:17
brwoodru12-Oct-05 6:17 
AnswerRe: Compile error with wininet.h Pin
prasad_som12-Oct-05 20:51
prasad_som12-Oct-05 20:51 
QuestionLink errors with jpeglib.h Pin
Alex Cutovoi12-Oct-05 3:25
Alex Cutovoi12-Oct-05 3:25 
Questionformat virtual disk drive in win2k Pin
Member 83286311-Oct-05 11:10
Member 83286311-Oct-05 11:10 
QuestionRe: format virtual disk drive in win2k Pin
Saksida Bojan12-Oct-05 19:56
Saksida Bojan12-Oct-05 19:56 
QuestionBYTE* to int Pin
Alex Cutovoi11-Oct-05 4:35
Alex Cutovoi11-Oct-05 4:35 
AnswerRe: BYTE* to int Pin
ben0909011-Oct-05 11:11
ben0909011-Oct-05 11:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.