Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

C³ÌÐò£º´òÓ¡1,2,3,..,nµÄÈ«ÅÅÁÐ

/*
˼·£ºµÝ¹éËã·¨
Ç°0..cur-1λÖÃÉÏÒѾ­Åźã¬µ±Ç°curλÖÃÈ¡Ò»¸öºÍÇ°Ã涼²»Ò»ÑùµÄ£¬È»ºóµÝ¹é´¦ÀíºóÃæµÄ¡£
*/
/* Êä³ö1,2,3,..,nµÄÅÅÁÐÊý */
#include <stdio.h>
#include <assert.h>
#include <malloc.h>
void p(int n)
{
extern void _p(int n, int cur, int *a);
int *a;
a = (int *) malloc(n * sizeof(int));
assert(a != NULL);
_p(n, 0, a);
free(a);
}
void _p(int n, int cur, int *a)
{
int i,j;
if (cur == n)
{
for (j=0; j<cur; j++)
{
printf("%d ", a[j]);
}
printf("\n");
return;
}
for (i=1; i<=n; i++)
{
for (j=0; j<cur; j++)
{
if (a[j] == i)
{
break;
}
}
if (j>=cur)
{
a[cur] = i;
_p(n, cur+1, a);
}
}
}
int main()
{
p(3);
}


Ïà¹ØÎĵµ£º

C/C++ ³ÌÐòÉè¼ÆԱӦƸ³£¼ûÃæÊÔÊÔÌâÉîÈëÆÊÎöÖ®Èý


ÊÔÌâ5£º±àдһ¸öº¯Êý£¬×÷ÓÃÊÇ°ÑÒ»¸öchar×é³ÉµÄ×Ö·û´®Ñ­»·ÓÒÒÆn¸ö¡£±ÈÈçÔ­À´ÊÇ“abcdefghi”Èç¹ûn=2£¬ÒÆλºóÓ¦¸ÃÊÇ“hiabcdefgh” 
¡¡¡¡º¯ÊýÍ·ÊÇÕâÑùµÄ£º
//pStrÊÇÖ¸ÏòÒÔ'\0'½áβµÄ×Ö·û´®µÄÖ¸Õë
//stepsÊÇÒªÇóÒƶ¯µÄn
void LoopMove ( char * pStr, int steps )
{
¡¡//ÇëÌî³ä...
}
¡¡¡¡½ ......

C3P0Êý¾ÝÔ´ Á¬½ÓAccessÊý¾Ý¿â


<?xml version="1.0" encoding="UTF-8"?>  
<beans xmlns="http://www.springframework.org/schema/beans"  
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
    xsi:schemaLocation="http://www.spri ......

ººÅµËþËã·¨µÄµÝ¹éÓë·ÇµÝ¹éµÄCÒÔ¼°C++Ô´´úÂë



ººÅµËþËã·¨µÄµÝ¹éÓë·ÇµÝ¹éµÄCÒÔ¼°C++Ô´´úÂë
By Minidxer | January 30, 2008
ººÅµËþ£¨ÓֳƺÓÄÚËþ£©ÎÊÌâÆäʵÊÇÓ¡¶ÈµÄÒ»¸ö¹ÅÀϵĴ«Ëµ¡£
¿ªÌì±ÙµØµÄÉñ²ªÀ­Â꣨ºÍÖйúµÄÅ̹Ų¶àµÄÉñ°É£©ÔÚÒ»¸öÃíÀïÁôÏÂÁËÈý¸ù½ð¸ÕʯµÄ°ô£¬µÚÒ»¸ùÉÏÃæÌ××Å64¸öÔ²µÄ½ðƬ£¬×î´óµÄÒ»¸öÔÚµ×Ï£¬ÆäÓàÒ»¸ö±ÈÒ»¸öС£¬ÒÀ´ÎµþÉÏ ......

C³ÌÐò£ºÊ¹Óà googletest ²âÊÔ¿ò¼Ü

googletest C/C++ ²âÊÔ¿ò¼Ü·Ç³£ºÃÓ㬽éÉܼ°ÏÂÔØÇë¿´  http://code.google.com/p/googletest/
//============================================================================
// ʹÓà googletest ²âÊÔ¿ò¼Ü
//============================================================================

// Returns n! ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ